The cache preallocated 74 MB of WAL to hold 0.3 MB - #12
Merged
Conversation
RocksDB sizes its write-ahead log to hold a full memtable flush, so the write buffer is a floor on the DB's on-disk size -- paid whether or not anything is cached. It was hardcoded at 64 MiB. Measured on a TemporalStore block cache holding 0.32 MB of content: the WAL file reported 331,697 bytes of data against 73,822,208 bytes allocated, and the cache directory was 74.5 MB of which 74.1 MB was preallocated air. A 222x fixed overhead, and for a small or short-lived cache it dwarfs the data it protects. MATRIXCACHE_ROCKSDB_WRITE_BUFFER_MB now sets it, defaulting to 64 so existing deployments are unchanged. Smaller memtables flush more often, so this trades write amplification against the fixed cost -- worth it only when the cache is small relative to 64 MiB, which is why it is a knob rather than a new default. Zero and unparseable values fall back to the default rather than configuring a degenerate DB; the test covers 0, , abc and -4. Suite: 284 passed, 0 failed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
RocksDB sizes its write-ahead log to hold a full memtable flush, so the write buffer is a floor on the DB's on-disk size — paid whether or not anything is cached. It was hardcoded at 64 MiB.
Measured on a TemporalStore block cache holding 0.32 MB of content:
74.1 MB of preallocated air. It is a fixed overhead per store, so it is noise at scale and dominates a small or short-lived cache completely.
MATRIXCACHE_ROCKSDB_WRITE_BUFFER_MBnow sets it, defaulting to 64 so existing deployments are unchanged. Smaller memtables flush more often, so this trades write amplification against the fixed cost — worth it only when the cache is small relative to 64 MiB, which is why it is a knob and not a new default.Zero and unparseable values fall back to the default rather than configuring a degenerate DB; the test covers
"0","","abc"and"-4".Suite: 284 passed, 0 failed.
🤖 Generated with Claude Code