[autoopt] 20260414-011-save-blocks-cursor-reuse#23511
Draft
mediocregopher wants to merge 1 commit intomainfrom
Draft
[autoopt] 20260414-011-save-blocks-cursor-reuse#23511mediocregopher wants to merge 1 commit intomainfrom
mediocregopher wants to merge 1 commit intomainfrom
Conversation
Amp-Thread-ID: https://ampcode.com/threads/T-019d8d0c-1120-707a-9e9d-4a78cf69a683 Co-authored-by: Amp <amp@ampcode.com>
Member
Author
|
derek bench |
Contributor
|
Your PR title doesn't follow the Conventional Commit guidelines. Example of valid titles:
Usage:
Breaking Changes Breaking changes are noted by using an exclamation mark. For example:
Help For more information, follow the guidelines here: https://www.conventionalcommits.org/en/v1.0.0/ |
Member
|
❌ Benchmark failed while unknown step. View logs |
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.
Reuse save_blocks MDBX cursors across block batches
Evidence
artifacts/24407188705/bench-reth-results/summary.jsonshows persistence wait dominating end-to-end latency at 29.57 ms mean / 265.62 ms p95.persistencethread at 297,408 samples, withPersistenceService::on_save_blocks -> DatabaseProvider::save_blocksaccounting for 293,897 inclusive samples.crates/storage/provider/src/providers/database/provider.rs, the hotsave_blocks()loop reopened append-only MDBX cursors forTransactionSenders,BlockBodyIndices, andTransactionBlockson every block even though the whole batch is already ordered and written inside one transaction.Hypothesis
If we reuse the append-only MDBX cursors across the whole
save_blocks()batch, gas throughput improves by ~0.2-0.6% because persistence avoids reopening the same write cursors for every block in the hottest disk-bound path.Success Metric
Plan
save_blocks()and thread them through the existing helper calls.cargo check -p reth-providerandcargo test -p reth-provider test_save_blocks_v2_table_assertions --lib.