Repository navigation
perf: release oversized S2 cache backing buffers - #947
Conversation
⚪ Performance A/B: no change beyond noise8 shape×range — 8 ⚪ same · results vs Loki: 7 same, 0 new difference(s), 1 pre-existing Loki profiles compared (like for like):
Every shape is within noise of the base build (±30% and 100 ms). 8 unchanged shape×range (within noise)
Cold (first-run) timings — what a user opening a panel sees
Why these shapes
base |
✅ Visual smoke: passedBase
Gate: a base-vs-PR data difference passes when the PR is closer to Loki, and fails when the PR diverges from Loki or Loki cannot decide it (at a range Loki does not hold, a difference passes when the same page proved that query to answer like Loki at a shorter range; otherwise label the pull request Core set montages (9): base | PR | Lokidd-fields-1h dd-landing-1h dd-service-logs-1h explore-logs-plain-1h explore-metric-plain-1h explore-sum-by-over-binary-1h explore-topk-by-per-step-1h explore-unwrap-sum-1h lvl-explore-rate-errors-by-service-1h Published inline montages: |
PR Quality ReportCompared against base branch Coverage and tests
Compatibility
Performance smokeLower CPU cost (
State
|









S2-compressed stats extents could retain their worst-case output backing allocation in RAM, queued disk writes and peer jobs while being charged only for compressed length. Copy output with excess capacity into an exact-length owned buffer before cache admission. This releases retained capacity; a capacity-only reslice would not.
Stored bytes, keys, tenant/auth scope, deadlines, invalidation, placement and logical budgets are unchanged. No new dependency or storage engine. Release metadata #946 is incorporated; only this fix remains under Unreleased.
Main versus PR
Measured main
fe43377f2ac78bdd4069d5ad5220f1a6ceeb6007; implementation74900fedce7ee537900895979096adbdbd3a77fc; fleet candidate8e848caf743b6c96c0b9561b7c1d24c07a0fc05e. Later commits add wiring, evidence and release metadata, without changing measured production code. Both fleet binaries have clean source identities. Go1.27.3/Darwin/arm64/M5Pro; benchmark GOMAXPROCS4.Controlled memory fixture: 256 independent extents, 10,000 points each, three fresh-process trials. Values are medians; cache and fixture remain alive through two GCs and ReadMemStats.
Cost: one additional compressed-length copy/allocation whenever excess capacity exists. The 50,291-byte copy consumes a 57,344-byte allocator class. Transient serialization/S2 scratch remains; heap savings are not a hard process limit or a fleet RSS reduction. No encoding/decoding latency difference is statistically significant in the retained ABBA comparison; timing controls vary. The earlier whole-handler control also has varying allocations and is retained as diagnostic only. No warm-query speedup claim.
Fleet and backend work
Isolated Loki3.7.9/VL1.52.0, same immutable192,000-line fixture and identical query/cell/ring identities; fresh processes/cache files and separate source ledgers. Three proxies, RF1/2, Tier0off, primary64MiB/1,024 entries per node, logical disk64MiB, S2,1s/1,000-entry flush,16MiB queue. Backend/reference-Loki caches are shared and may already be warm. Twenty measured queries per cell.
All400/400 answers are nonempty200 and equal Loki. Sequential instrumented-loopback timings are descriptive, not proof this memory change caused a query speedup.
Exact repeats bypass VL lookup; disabled Tier0 is not a measured miss. Shift/refresh reuses held buckets; each missing minute is fetched with two VL calls, severity-source discovery followed by stats_query_range, both bounded to that minute. Disk writes can be delayed priming work, not measured-query admissions. CPU includes background process work. File lengths and encoded traffic are not physical SSD IOPS/throughput. Raw per-layer occupancy, hits/lookups, eviction counters, request ranges and separate priming/startup observations are retained.
The node-loss cells stop node0 but do not force every queried key to belong to it; they do not prove RF1 can lose its sole copy without VL. Pressure, forced-owner loss, distributed deletion, fleet scaling, VL-server CPU/RSS and physical device I/O are not newly proven. Darwin's process-memory export is GoSys, not RSS; kernel lifetime Maxrss is separately scoped in raw cells.
Full provenance, raw compressed cells/wire logs, pprof, byte hashes, controls, reproduction and independent verifier: retained proof.
Validation and visual evidence