feat(engine): support dual-frontier partial trie persistence#24100
feat(engine): support dual-frontier partial trie persistence#24100mediocregopher wants to merge 99 commits into
Conversation
Co-authored-by: Brian Picciano <933154+mediocregopher@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019d9639-935f-73a4-ba50-7682a7b9aca0 Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: Brian Picciano <933154+mediocregopher@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019d9639-935f-73a4-ba50-7682a7b9aca0 Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: Brian Picciano <933154+mediocregopher@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019d968b-970d-735e-844c-b83ff245ce05 Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: Brian Picciano <933154+mediocregopher@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019d968b-970d-735e-844c-b83ff245ce05 Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: Brian Picciano <933154+mediocregopher@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019d9728-846b-7418-8a69-ddbba65ce656 Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: Brian Picciano <933154+mediocregopher@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019d9728-846b-7418-8a69-ddbba65ce656 Co-authored-by: Amp <amp@ampcode.com>
Raise the default persistence threshold to 10 and derive the default backpressure threshold from the persistence and in-memory thresholds. Enable alloy getrandom for reth-engine-primitives tests so the existing B256::random() test coverage keeps compiling. Co-authored-by: Brian Picciano <933154+mediocregopher@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019d9a2b-716e-774d-8db7-b0308fa96a23 Co-authored-by: Amp <amp@ampcode.com>
Make masked save_blocks persistence track partial trie progress in the Finish checkpoint and switch the trie-masking API to a masked-suffix start index so the final block is always covered by the mask when partial trie persistence is used. Co-authored-by: Brian Picciano <933154+mediocregopher@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019d9a2b-716e-774d-8db7-b0308fa96a23 Co-authored-by: Amp <amp@ampcode.com>
Return finish-stage partial trie progress from the persistence thread and keep blocks above that trie boundary resident in memory after persistence completes. This preserves the old prune-through-tip behavior when the partial trie matches the persisted tip or is absent. Co-authored-by: Brian Picciano <933154+mediocregopher@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019d9ab4-1eab-713f-9d5d-71903b7bc724 Co-authored-by: Amp <amp@ampcode.com>
Co-Authored-By: Brian Picciano <933154+mediocregopher@users.noreply.github.com>
Co-authored-by: Brian Picciano <933154+mediocregopher@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019dab40-7d65-709b-90d6-98965c5c6a65 Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: Brian Picciano <933154+mediocregopher@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019dab40-7d65-709b-90d6-98965c5c6a65 Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: Brian Picciano <933154+mediocregopher@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019dab6f-7cee-755e-9f9c-309ae0b8517c Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: Brian Picciano <933154+mediocregopher@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019dab6f-7cee-755e-9f9c-309ae0b8517c Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: Brian Picciano <933154+mediocregopher@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019daba4-3598-758d-8771-cb5db784db81 Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: Brian Picciano <933154+mediocregopher@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019daba4-3598-758d-8771-cb5db784db81 Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: Brian Picciano <933154+mediocregopher@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019daba4-3598-758d-8771-cb5db784db81 Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: Brian Picciano <933154+mediocregopher@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019dafa5-05ee-739e-a0b6-037cc30e4a0e Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: Brian Picciano <933154+mediocregopher@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019daba4-3598-758d-8771-cb5db784db81 Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: Brian Picciano <933154+mediocregopher@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019dafbb-3571-73ef-ae67-43c242e2bf23 Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: Brian Picciano <933154+mediocregopher@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019dafbb-3571-73ef-ae67-43c242e2bf23 Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: Brian Picciano <933154+mediocregopher@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019dafbb-3571-73ef-ae67-43c242e2bf23 Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: Brian Picciano <933154+mediocregopher@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019db57a-7f08-7761-9a50-27a2a5c8f917 Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: Brian Picciano <933154+mediocregopher@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019db57a-7f08-7761-9a50-27a2a5c8f917 Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: Brian Picciano <933154+mediocregopher@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019db57a-7f08-7761-9a50-27a2a5c8f917 Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: Brian Picciano <933154+mediocregopher@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019dbc30-68d0-76b8-a32c-e1173122ca48 Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: Brian Picciano <933154+mediocregopher@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019dbc30-68d0-76b8-a32c-e1173122ca48 Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: Brian Picciano <933154+mediocregopher@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019dbee7-f576-769d-923c-dfdfe0a40858 Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: Brian Picciano <933154+mediocregopher@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019dbf08-3c9d-736b-9b47-3070f2bf2a54 Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: Brian Picciano <933154+mediocregopher@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019dcdca-2c60-711c-b1b8-7a6001a950fd Co-authored-by: Amp <amp@ampcode.com>
|
derek bench big-blocks blocks=50 baseline-args="--engine.persistence-threshold=13 --engine.persistence-backpressure-threshold=20" feature-args="--engine.persistence-threshold=13 --engine.num-state-masking-blocks=10 --engine.persistence-backpressure-threshold=20" slack=never samply |
|
✅ Benchmark complete! View job Benchmark Results
50 big blocks, driver: txgen, 12 warmup Wait Time BreakdownPersistence Wait
Trie Cache Update Wait
Execution Cache Update Wait
ChartsSamply Profiles
Grafana Dashboard |
|
derek bench big-blocks blocks=500 baseline-args="--engine.persistence-threshold=11 --engine.persistence-backpressure-threshold=24" feature-args="--engine.persistence-threshold=21 --engine.num-state-masking-blocks=10 --engine.persistence-backpressure-threshold=42" |
|
✅ Benchmark complete! View job Benchmark Results
500 big blocks, 125 warmup Wait Time BreakdownPersistence Wait
Trie Cache Update Wait
Execution Cache Update Wait
ChartsGrafana Dashboard |
…l-persistence-clean # Conflicts: # crates/chain-state/src/lazy_overlay.rs # crates/engine/tree/src/tree/mod.rs # crates/storage/provider/src/providers/state/overlay.rs
|
derek bench big-blocks baseline-args="--engine.persistence-threshold=5" feature-args="--engine.persistence-threshold=11 --engine.num-state-masking-blocks=6" slack=never |
|
❌ Benchmark failed while running benchmarks. View logs |
|
derek bench big-blocks baseline-args="--engine.persistence-threshold=5" feature-args="--engine.persistence-threshold=11 --engine.num-state-masking-blocks=6" slack=never |
|
✅ Benchmark complete! View job Benchmark Results
65 big blocks, 16 warmup, 10 run pairs Wait Time BreakdownPersistence Wait
Trie Cache Update Wait
Execution Cache Update Wait
ChartsGrafana Dashboard |
|
derek bench big-blocks baseline-args="--engine.persistence-threshold=5" feature-args="--engine.persistence-threshold=11 --engine.num-state-masking-blocks=6" slack=never |
|
✅ Benchmark complete! View job Benchmark Results
65 big blocks, 16 warmup, 10 run pairs Wait Time BreakdownPersistence Wait
Trie Cache Update Wait
Execution Cache Update Wait
ChartsGrafana Dashboard |
…rtial-persistence-clean # Conflicts: # crates/node/core/src/args/engine.rs # crates/storage/provider/src/providers/database/provider.rs # docs/vocs/docs/pages/cli/reth/node.mdx
|
derek bench big-blocks baseline-args="--engine.persistence-threshold=5" feature-args="--engine.persistence-threshold=11 --engine.num-state-masking-blocks=6" slack=never |
|
❌ Benchmark failed while building binaries. View logs |
…l-persistence-clean
|
derek bench big-blocks baseline-args="--engine.persistence-threshold=5" feature-args="--engine.persistence-threshold=11 --engine.num-state-masking-blocks=6" slack=never |
|
✅ Benchmark complete! View job Benchmark Results
65 big blocks, 16 warmup, 10 run pairs Wait Time BreakdownPersistence Wait
Trie Cache Update Wait
Execution Cache Update Wait
ChartsGrafana Dashboard |
|
derek bench big-blocks blocks=300 run-pairs=6 bal=true baseline-args="--engine.persistence-threshold=5" feature-args="--engine.persistence-threshold=11 --engine.num-state-masking-blocks=6" slack=never |
|
✅ Benchmark complete! View job Benchmark Results
300 big blocks, 75 warmup, 6 run pairs, BAL: true Wait Time BreakdownPersistence Wait
Trie Cache Update Wait
Execution Cache Update Wait
ChartsGrafana Dashboard |
|
hi, is this still active? |
|
hi @debjit-bw yes this is still active, there's some other optimizations which I'm working on ahead of this to make it viable, e.g. #24355 |
|
thanks @mediocregopher, then i will be pinning this commit in a PoC repo (where we use reth as an sdk), since it will eventually made into main |
…cregopher/partial-persistence-clean # Conflicts: # crates/node/builder/src/launch/common.rs # crates/node/core/src/args/engine.rs # docs/vocs/docs/pages/cli/reth/node.mdx


















Tracks separate durable frontiers for block data and state/trie data so persistence can defer trie writes while keeping reorg/unwind and historical overlay paths correct.