Summary
State domain reads (GetLatest over .kv snapshots) are dominated by kv touches — the binary search into the .kv at .bt pivot offsets. The accessor's M (pivot density, default 256) sets the cold probe count (≈ log₂ M). Lower values of M produce narrower ranges to search in the kv file and leads to smaller number of potentially cold touches.
This task tries different M-value for the btree and records cold/warm access and bt sizes for M=256(default), 64, 16
Storage domain — .bt size & btnav latency per M
.kv file |
steps |
.kv size |
M256 bt / cold / warm |
M64 bt / cold / warm |
M16 bt / cold / warm |
0-8192 |
8192 |
71 GB |
1.74 GB / 172 µs / 5 µs |
2.80 GB / 111 µs / 3 µs |
7.02 GB / 93 µs / 3 µs |
8704-8960 |
256 |
2.4 GB |
68 MB / 160 µs / 3 µs |
110 MB / 108 µs / 2 µs |
278 MB / 89 µs / 2 µs |
8960-9088 |
128 |
1.5 GB |
42 MB / 161 µs / 3 µs |
68 MB / 107 µs / 2 µs |
172 MB / 95 µs / 2 µs |
9088-9120 |
32 |
466 MB |
12.6 MB / 157 µs / 2 µs |
20 MB / 106 µs / 2 µs |
51 MB / 92 µs / 1 µs |
Cold = vmtouch -e then random-key Get; warm = cached. btnav isolated from existence-filter (~0.5 µs) and value fetch (~0.25 µs), which are negligible for storage. (8192-8704 omitted — probe harness hits a decompressor quirk on that one file; pattern is identical to the rest.)
Findings
increase M reduces the access cost, and increases the file size. We can leverage this to keep the latest (smallest step ranges) with higher M -- chaintip queries those most often. The oldest step ranges (largest) can continue using M=256
others:
- btnav is ~99% of a storage read; kvei and kvval are noise.
- Cold latency depends only on M, not file size (~160/108/92 µs for 256/64/16 everywhere) — it's
log₂ M cold probes. Diminishing returns past M64.
- Warm latency is ~2–5 µs regardless of M — when a file is cache-resident, M is irrelevant to speed.
- Index size scales with file size, so low-M cost is what differs: M16 is 51 MB on a 466 MB file but 7 GB on the 71 GB file.
Summary
State domain reads (
GetLatestover.kvsnapshots) are dominated by kv touches — the binary search into the.kvat.btpivot offsets. The accessor'sM(pivot density, default 256) sets the cold probe count (≈ log₂ M). Lower values ofMproduce narrower ranges to search in the kv file and leads to smaller number of potentially cold touches.This task tries different M-value for the btree and records cold/warm access and bt sizes for M=256(default), 64, 16
Storage domain —
.btsize & btnav latency per M.kvfile.kvsize0-81928704-89608960-90889088-9120Cold =
vmtouch -ethen random-keyGet; warm = cached. btnav isolated from existence-filter (~0.5 µs) and value fetch (~0.25 µs), which are negligible for storage. (8192-8704omitted — probe harness hits a decompressor quirk on that one file; pattern is identical to the rest.)Findings
increase M reduces the access cost, and increases the file size. We can leverage this to keep the latest (smallest step ranges) with higher M -- chaintip queries those most often. The oldest step ranges (largest) can continue using M=256
others:
log₂ Mcold probes. Diminishing returns past M64.