Repository navigation
perf(frag_reuse): cache stable-partition row-map chunks - #9252
Conversation
|
ACTION NEEDED The PR title and description are used as the merge commit message. Please update your PR title and description to match the specification. For details on the error please inspect the "PR Title Check" action. |
2442bd1 to
8ff878a
Compare
8ff878a to
20b91b2
Compare
20b91b2 to
91eff7d
Compare
91eff7d to
806e29c
Compare
806e29c to
adcb452
Compare
adcb452 to
fefb1bb
Compare
fefb1bb to
0f434b0
Compare
fe3311c to
6514fb5
Compare
6514fb5 to
dff171c
Compare
dff171c to
6283ce9
Compare
6283ce9 to
aa29da4
Compare
aa29da4 to
3b836e4
Compare
3b836e4 to
e1a2e50
Compare
e1a2e50 to
83a6a83
Compare
There was a problem hiding this comment.
The new run-boundary lookahead removes the quadratic scan for contiguous requests while preserving sparse low-cache reads. The chunk cache remains a sound way to avoid repeated row-map I/O without changing the file format.
Decoded chunks share the index-cache budget with index partitions. The reported 64 MiB experiment thrashed when the combined working set did not fit, so size that cache before prewarming on constrained deployments. Remote-object-store throughput remains unmeasured.
This PR remains stacked on #9187, whose current head is this PR’s base. Land or rebase after that prerequisite.
|
The |
A query that translates addresses through a tagged fragment-reuse history re-read the row-map label blocks on every call. Cache the labels in the session index cache in ~4 MiB chunks (32 blocks, keyed by transition fingerprint and chunk index), so each part of the row map is read at most once. The chunk unit keeps the entry count small (~48 at 100M rows, ~477 at 1B) while making each cold miss one large sequential range read. On a 20M-row fixture this cuts cold _fri reads from ~10,440 to ~17 per query. Cache-off behavior is byte-identical (a regression test compares cached and uncached point, batch and sweep translations). When the cache cannot retain a chunk, labels are read per request: a run of adjacent blocks is one range read, a point lookup reads exactly its block, and a sparse batch never reads a block it does not touch. The end of a contiguous run is discovered once per run and reused for every block inside it, so a request touching B consecutive blocks costs B - 1 lookahead steps instead of B * (B - 1) / 2. Claude-Session: https://claude.ai/code/session_01DgAshYD7wVzPVdjXRuWPPs Co-Authored-By: Claude Fable 5.1 <[email protected]>
Summary
Caches stable-partition row-map labels to reduce repeated storage reads while indexes still rely on query-time FRI translation.
Previously, the mapping object was cached but its labels were reread for different index pages and later queries. Builds on #9187; no format or translation-semantics changes.
What changes
Tradeoffs and evidence
A default chunk contains about 2M labels, requiring approximately 4 MiB plus overhead. It shares the cache budget with index state, so an undersized cache can still thrash.
In the recorded 20M-row NVMe benchmark, cold row-map reads fell from 10,440 to 17 and bytes from 419 MB to 12.9 MB. Local QPS remained similar; object-storage throughput improvement still requires measurement.
Tests
Covers cached/uncached equivalence, zero/sub-chunk capacity, sparse reads, multi-chunk maps, and duplicates/deletions. A 300-block case verifies 299 lookahead steps instead of 44,850.