node/ethconfig, cmd/rpcdaemon: enable FcuBackgroundCommit and 128MB state cache by default - #22269
Draft
yperbasis wants to merge 2 commits into
Draft
node/ethconfig, cmd/rpcdaemon: enable FcuBackgroundCommit and 128MB state cache by default#22269yperbasis wants to merge 2 commits into
yperbasis wants to merge 2 commits into
Conversation
yperbasis
added a commit
that referenced
this pull request
Jul 6, 2026
The flip to 128MB (Coherent by default) moves to the stacked PR #22269 together with the FcuBackgroundCommit default flip; this PR keeps the groundwork only (the with-datadir path honors the flag, and the Coherent cache fixes make a non-zero setting work as designed).
This was referenced Jul 6, 2026
yperbasis
added a commit
that referenced
this pull request
Jul 16, 2026
At a zero budget the eviction loop drains every insert straight back out, so Get/GetCode took the global lock twice and churned the btree and eviction list per read-through, and OnNewBlock fed-then-evicted every batch entry. Skip the lookup and the add when the budget is zero; reads fall through to the caller's tx snapshot as before. Zero budget is the standalone rpcdaemon default until #22269 raises it. Behavior-preserving: TestZeroBudgetRetainsNothing pins the contract (nothing retained, reads resolve on the tx snapshot rather than announced batch data) and was confirmed green before the change too.
This was referenced Jul 16, 2026
Closed
Moved from #21293: with the FCU response returning pre-commit, the version-keyed Coherent cache is what keeps a standalone daemon's reads consistent with its committed view instead of serving pre-commit state-change data against an older head. --state.cache=0 remains the no-retention escape hatch (snapshot-consistent, nothing cached).
FCU responses return to the consensus client before the MDBX flush+commit lands, recovering the FCU latency regression tracked in #21008 (p50 ~+80ms vs release/3.4). Groundwork — overlay/committed read split, version-keyed rpcdaemon cache, Busy tolerance, WaitIdle races — landed separately.
yperbasis
force-pushed
the
yperbasis/fcu-bg-commit-default-on
branch
from
July 17, 2026 08:37
538c871 to
119677c
Compare
yperbasis
changed the base branch from
alex/fcu_bg_commit_35
to
yperbasis/coherent-state-cache
July 17, 2026 08:37
This was referenced Jul 17, 2026
pull Bot
pushed a commit
to Dustin4444/erigon
that referenced
this pull request
Jul 18, 2026
Renames `SimpleCache` → `LatestBatchCache` (with `NewSimple` → `NewLatestBatchCache`, `SimpleView` → `LatestBatchView`, `simple.go` → `latest_batch.go`). "Simple" described the implementation rather than the contract, and suggested Simple and Coherent sit on a complexity spectrum. They actually sit on opposite sides of a semantic fork: - **`Coherent`** — snapshot-consistency first: entries are keyed by `PlainStateVersion`, so a reader stays consistent with its own committed view and never sees fresher data. - **`LatestBatchCache`** — freshness first: version-blind, it serves the most recent announced state-change batch on top of the caller's tx, deliberately showing announced-but-not-yet-committed account data; staleness is bounded to one batch by FCU serialization. That fork is what decides which cache is safe where (in-process txpool vs RPC reads — see erigontech#22532 / erigontech#22269), and the new name carries it: content (the latest batch), lifetime (replaced wholesale per batch), and the trade-off (by contrast with `Coherent`). Also updates the type doc comment to lead with the contract. One cleanup rider in the same spirit: the dead `Evict() int { return 0 }` stub is removed (no callers, not part of the `Cache` interface — a `DummyCache`-era leftover). Mechanical rename + dead-code removal, no behavior change (TDD not applicable). --------- Co-authored-by: Alex Sharov <AskAlexSharov@gmail.com>
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.
Flips
FcuBackgroundCommittotrueso the FCU response returns to the consensus client before the MDBX flush+commit lands. Stacked on #22532 (version-keyed state cache + post-commit announce, the piece this PR's128MBdefault builds on). Merge-blocked on the rest of the #21293 split as well — the flip activates background commit everywhere, so it also requires #22533 (overlay/committed RPC read split), #22534 (overlay safe-close invariant), and #22535 (Busy tolerance + post-FCUWaitIdle) to land first. GitHub retargets this tomainwhen #22532 merges; do not merge before the other three.Sets the standalone rpcdaemon
--state.cachedefault to128MB. Standalone daemons useCoherentat every configured budget: positive budgets retain version-keyed entries, while0MBretains none, disables new-block waiting, and falls back to each caller's transaction snapshot. With the FCU response returning pre-commit, this keeps reads consistent with the committed view instead of serving pre-commit state-change data against an older head. The cache runs without cross-block root carry-over (bounded warmth; re-enabling it is tracked in #22276).Motivated by #21008 — local profiling on mainnet at tip vs
release/3.4showed p50 FCU latency regressed by ~+80 ms (mean ~+90 ms, p99 ~+160 ms) with wider burst tails. Background commit decouples the FCU response from the MDBX fsync so the CL gets ACK on the overlay-published head rather than the disk-flushed head.The regression itself was caused by #19961 moving TxLookup / Senders / Finish into the synchronous FCU path via
PipelineExecutor.RunLoop. Background commit masks this by hiding the fsync from the FCU response; the root-cause fix (move those stages back to a backgroundStageLoop, per #21008 comment) is out of scope.Known limitation
eth_call(latest),eth_getBalance(latest),eth_getStorageAt(latest),eth_getCode(latest)served by the embedded daemon: during the bg-commit window the header resolves to N (via overlay tables) but state reads evaluate against N-1, because the SD's domain mem batch is not exposed by the block overlay. Bounded staleness (~commit duration), not corruption. The SD-aware temporal view that closes this gap is tracked in #21314.Test plan
release/3.4levels--state.cache, and thateth_call(latest)lag matches the documented limitation