Skip to content

execution: drop BlockStateCache from tx execution workers (P1) - #23146

Draft
sudeepdino008 wants to merge 1 commit into
mainfrom
sudeepdino008/bsc-rm-worker-committed-tier
Draft

execution: drop BlockStateCache from tx execution workers (P1)#23146
sudeepdino008 wants to merge 1 commit into
mainfrom
sudeepdino008/bsc-rm-worker-committed-tier

Conversation

@sudeepdino008

@sudeepdino008 sudeepdino008 commented Aug 10, 2026

Copy link
Copy Markdown
Member

Part 1 of removing/reducing dependence on BlockStateCache (#23140).

Summary

BlockStateCache is used in two places:

  • in tx exec workers reader: versionedMap (outside of reader) -> BlockCache -> sd.mem -> sd.parent.mem -> StateCache -> temporalDb
  • write buffer: tx results are recorded here at apply/finzalize tx time.

BlockStateCache has two parts:

  • "current" data: accumulated writes during block execution
  • "committed" data: state AsOf start of block execution, loaded as needed.

  • BlockStateCache is redundant and probably be removed. Exploring that in more PRs. Even if don't manage to remove it completely; reducing its scope is useful.
  • This PR removes the first usage -- versionedMap already provides block-accumulated changes (and readCurrent=false so BlockStateCache.current is anyway skipped.); StateCache provides the "committed" data. So tx execution workers are already covered.
  • the StateCache is already an in-mem cache. BlockStateCache's "committed state" is acting as a duplicate layer on top, interfering with StateCache retention/LRU policies etc. (so it justifies removal of "commitment state" of BlockCache - will be done in separate PR)

@sudeepdino008 sudeepdino008 changed the title execution: drop the per-block worker committed-state cache (#23140) execution: drop BlockStateCache from tx execution workers Aug 11, 2026
Parallel workers read committed pre-block state through a per-block
BlockStateCache tier (TxTask.BlockStateCache). That tier is a pure read cache:
the base chain (sd.mem -> StateCache -> files) is frozen for a block's whole
execution (sd.mem changes only at blockCache.Flush in completeBlock, after which
the next block is scheduled), and intra-block isolation comes from the version
map layered on top of the reader. So the tier adds no isolation.

It does duplicate StateCache and starve it: a slot read 5000 times in a block
reached StateCache once, so StateCache's LRU ranked hot keys as cold. Removing
the tier lets workers fill and read StateCache directly, restoring its read
stream. Values are unchanged because the base is frozen per block.

This removes the worker tier only (TxTask.BlockStateCache and its plumbing). The
finalize/apply write buffer (be.blockStateCache) is untouched; later steps of
#23140 move it to the version map.
@sudeepdino008
sudeepdino008 force-pushed the sudeepdino008/bsc-rm-worker-committed-tier branch from 3960cee to d07d799 Compare August 12, 2026 06:13
@sudeepdino008
sudeepdino008 changed the base branch from sudeepdino008/sdmem-commitment-lock-split to main August 12, 2026 06:13
@sudeepdino008 sudeepdino008 changed the title execution: drop BlockStateCache from tx execution workers execution: drop BlockStateCache from tx execution workers (P1) Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant