Repository navigation
accounts-db: read storages with direct I/O when generating the index - #15941
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #15941 +/- ##
=======================================
Coverage 82.2% 82.2%
=======================================
Files 938 938
Lines 372938 372971 +33
=======================================
+ Hits 306612 306658 +46
+ Misses 66326 66313 -13 🚀 New features to boost your workflow:
|
kskalski
force-pushed
the
ks/gen_index_dio
branch
4 times, most recently
from
October 12, 2026 01:22
3e2090d to
b450618
Compare
Problem: Index generation reads every storage once through the page cache. On a mainnet fastboot the reads fill memory, so the growing index allocates through kernel direct reclaim for much of the scan. Summary of Changes: - read storages for index generation the way snapshot archiving does, with direct I/O when `AccountsDbConfig::use_direct_io` is set - set `use_direct_io` from the existing `--no-accounts-db-snapshots-direct-io` flag in the validator and ledger-tool, since both already validate the account paths for direct I/O - rename `open_file_for_archive` to `open_file_for_bulk_read`, since index generation now shares it with archiving Testing: Mainnet fastboot restarts against the base commit (1.2 B accounts, two runs each) cut `index_time` from 37.8 s to 29.2 s and `rebuild_bank` from 40.8 s to 31.6 s, with identical indexed account counts.
kskalski
force-pushed
the
ks/gen_index_dio
branch
from
October 12, 2026 02:32
b450618 to
69e186a
Compare
kskalski
marked this pull request as ready for review
October 12, 2026 03:34
|
Link back to previous PRs w.r.t. direct io flags inside AccountsDbConfig: |
brooksprumo
reviewed
Oct 12, 2026
Problem: Each index generation thread takes 64 storages at a time from the shared queue, so with fewer than about 64 storages per thread a few threads take all the storages while the others stay idle. Summary of Changes: Compute the batch size from the number of storages and threads, capped at 64 to still bound the extra fds opened with direct I/O.
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.
Problem
Index generation reads every storage once through the page cache. On a mainnet fastboot the reads fill memory, so the growing index allocates through kernel direct reclaim for much of the scan.
Summary of Changes
AccountsDbConfig::use_direct_iois setuse_direct_iofrom the existing--no-accounts-db-snapshots-direct-ioflag in the validator and ledger-tool, since both already validate the account paths for direct I/Oopen_file_for_archivetoopen_file_for_bulk_read, since index generation now shares it with archivingTesting
Mainnet fastboot restarts against the base commit (1.2 B accounts, two runs each) cut
index_timefrom 37.8 s to 29.2 s andrebuild_bankfrom 40.8 s to 31.6 s, with identical indexed account counts.