perf(chain): 禁用空块生产,防止磁盘快速耗尽

问题: skip_timeout_commit=true 导致 ~44ms/块,无交易时
空块以 ~23块/秒 速度堆积,约 2-3 GB/天纯空块数据。

修复: create_empty_blocks = false
- 没有待处理交易时不出块
- 有交易提交时立即触发出块,延迟不受影响
- 彻底消除空块造成的磁盘浪费

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-02-20 07:50:14 -08:00
parent d53203d56e
commit 23055c604c
1 changed files with 9 additions and 0 deletions

View File

@ -111,6 +111,14 @@ sed -i 's/timeout_commit = "5s"/timeout_commit = "1s"/' "$CONFIG_TOML"
# 实际出块时间可降到 500ms-800ms
sed -i 's/skip_timeout_commit = false/skip_timeout_commit = true/' "$CONFIG_TOML"
# ============================================================
# 空块控制 — 防止磁盘快速耗尽
# ============================================================
# create_empty_blocks = false: 没有待处理交易时不出空块
# 有交易提交时立即触发出块,延迟不受影响
# 避免 ~23块/秒 的空块堆积 (按44ms/块计算 ≈ 2-3 GB/天)
sed -i 's/create_empty_blocks = true/create_empty_blocks = false/' "$CONFIG_TOML"
# ============================================================
# Mempool 优化 — 提升交易吞吐
# ============================================================
@ -136,4 +144,5 @@ echo " - Consensus timeouts: prevote/precommit 500ms (reduced from 1s)"
echo " - IAVL cache: 2,000,000 nodes (up from 781,250)"
echo " - Mempool size: 10,000 txs (up from 5,000)"
echo " - Mempool cache: 20,000 (up from 10,000)"
echo " - Empty blocks: DISABLED (only produce blocks when txs pending)"
echo "============================================================"