increase ChangeSets3 prune limit at chain tip#21204
Merged
Merged
Conversation
…00000 On heavy-state chains (bloatnet) the 1000-entry per-call cap drains ~85x slower than ChangeSets3's creation rate once initialCycle=false. The 2s timeout still bounds wall-time; 200k just removes the artificial floor on how many entries one call can touch.
… check Per-iteration select-on-logEvery was a syscall on every row. Moved into the same mod-stride as ctx-done + timeout, and bumped stride from 100 to 1000. For 200k-row prunes this shaves the per-iter overhead noticeably without affecting timeout responsiveness (1000 iters at \~microseconds each = under 10ms granularity).
AskAlexSharov
approved these changes
May 15, 2026
ADD12
pushed a commit
to ADD12/erigon
that referenced
this pull request
May 16, 2026
…ech#21216) Cherry-pick of erigontech#21204 to main.
pull Bot
pushed a commit
to Dustin4444/erigon
that referenced
this pull request
May 29, 2026
Cherry-pick of 5 performance improvements from the `performance` branch to `main`: 1. warmuper: cancelable worker — erigontech#20941 2. db/state, cmd/integration: 4x larger commitment rebuild shard, squeeze flag transparent — erigontech#21147 3. db/rawdb: increase ChangeSets3 prune loop stride 100→1000, move log inside stride check — erigontech#21204 4. db/seg: increase bufio pool size from 256KB to 512KB 5. db/kv/prune: remove dead `limit` parameter from `TableScanningPrune` (accepted but never forwarded internally) --------- Co-authored-by: awskii <awskii@users.noreply.github.com> Co-authored-by: moskud <sudeepdino008@gmail.com> Co-authored-by: info@weblogix.biz <admin@10gbps.weblogix.it>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On heavy-state chains (bloatnet),
ChangeSets3was the dominant chaindata growth source post-catch-up — file grew unboundedly because prune couldn't keep up with the per-block changeset write rate.Root cause: the
pruneDiffsLimitOnChainTip = 1000cap inPruneExecutionStage(active wheninitialCycle=false). On bloatnet:Observed on a 12-hour bloatnet run: ChangeSets3 stayed at 0 B during catch-up (
initialCycle=trueoverrides the cap tomath.MaxInt), then ballooned from 0 → 40 GB in the ~3 hours after the chain caught up. File size grew 38 GB → 181 GB over the same window, with ~80% of the new space attributable to ChangeSets3 + write amplification from a too-small reclaim pool.Changes
execution/stagedsync: bump ChangeSets3 chain-tip prune limit 1000 → 200000.
The 2s timeout still bounds wall time; the cap raise removes the artificial floor on how many entries one call drains. With 200k cap × 2s timeout, a single PruneExecutionStage invocation can drain up to ~1 GB of changesets — well above the per-cycle write rate.
db/rawdb: PruneTable: fold logEvery + ctx + timeout into one mod-1000 check.
Per-iteration
select-on-logEvery.Cwas a syscall on every row. Moved into the same mod-stride as ctx-done + timeout, and bumped stride 100 → 1000. For 200k-row prunes this shaves the per-iter overhead noticeably without affecting timeout responsiveness (1000 iters at ~microseconds each = under 10 ms granularity).Notes
initialCycle=true) is unaffected — the override there already usesmath.MaxInt/ 1h.Test plan