Repository navigation
beatree: add Options::prepopulate_leaf_cache - #953
Draft
citizen-stig wants to merge 3 commits into
Draft
citizen-stig wants to merge 3 commits into
citizen-stig wants to merge 3 commits into
Conversation
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017wb3qFhAoTArSEcSTGVDCu
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.
After a restart the beatree leaf cache is empty, so the first sessions pay for cold leaf reads. NOMT can already warm the page cache on startup (
Options::prepopulate_page_cache). This adds the equivalent for the leaf cache.Changes
Options::prepopulate_leaf_cache(bool), defaultfalse.Nomt::opencallsStore::prepopulate_leaf_cache(commit_concurrency)→Tree::prepopulate_leaf_cache. This collects leaf page numbers from the bottom-level branches in key order, up toLeafCache::capacity(), then reads and inserts them oncommit_concurrencyscoped threads.Index::branches()andLeafCache::capacity().nomt/tests/prepopulate_leaf_cache.rs: it writes more leaves than a 1 MiB cache holds, reopens with the option on, and reads every value back.Limitations:
capacityleaves), not by how often they're used. That helps most when the working set is small enough to fit, or is clustered at the start of the key space.LeafCache::insertdoes not evict, and page numbers are spread across shards by hash. So a shard can briefly hold more than its share until regular eviction runs.Nomt::openblocks until the reads finish: up toleaf_cache_sizeMiB of I/O.Performance impact
TODO: to be filled in after benchmarking (startup time and the first sessions after a reopen).