Repository navigation
perf(fileservice): cache late scan reads without forced eviction - #32093
Conversation
Why the cache gain disappears at SF100Diagnosis of draft PR #32093, exact production head FindingThe bounded FIFO observation history forgets a long cyclic scan before its next visit. The PR therefore continues bypassing decoded admission at SF100, even with most of the configured cache empty. SF10 fits within the history window and reaches decoded-cache hits. This is separate from SQL spilling. Comparable isolated Q6 diagnosticsFresh private clone/process per arm; both scales use all 32 local CPUs, 48 GiB application limit, no swap, 16 GiB CN SHARED decoded cache, fileservice disk cache disabled,
SF10 PR becomes 100% decoded-cache hits on execution 3; main remains about 56.4%. SF100 remains about 5.7% in both versions on execution 4. All four original cases have zero observed spill events, zero swap, and zero cache-pressure admission skips/evictions/triggers. The SF100 PR repeats roughly 278,000 local entry reads per query. Source mechanism
Native Q6 scans show 7,324 blocks at SF10 versus 73,684 at SF100. The ordinarily admitted prefix is roughly 4,128 blocks: about 56% of SF10 but only 5.6% of SF100. The SF10 late-key working set is about 12,800 entries; SF100 is about 278,000. Even with zero path bytes the 16 MiB history cannot retain more than 65,536 keys. A long repeated scan inserts new observations while evicting the previous pass before those keys can be reused. Runtime confirmation of the binding limitA separate diagnostic binary was built from the exact PR head using a Go build overlay, adding counters only. Tracked production sources and the scored benchmark binaries were unchanged. This run is diagnostic evidence, not scored performance evidence. The last counter snapshot after repeated SF100 Q6 shows: The actual key cost is 298 bytes, so the history retains exactly 56,299 keys. The metadata limit binds while the history represents only about 3.20 GiB of decoded data, far below its separate 14.39 GiB represented-data bound. Every observed candidate in this isolated long cyclic scan is denied admission. Cache-space exhaustion and the represented-data bound are not causing these observed denials. This confirms the exact-key FIFO metadata window as the immediate cause. All four query calls and the subsequent profiling/native calls in this diagnostic completed under the strict no-spill gate. Original uninstrumented diagnostics independently show the same cache hit behavior. CPU evidenceSeparate CPU-clock user profiles after four executions: SF100 PR has 38.63% self samples in LZ4 decode (main 47.67%); SF10 PR has no sampled LZ4 decode. SF10 profiles are short (126 PR samples), so percentages are directional, not a precise CPU savings estimate. The cache counters and physical-read deltas establish the miss behavior independently. Valid SF100 whole-suite measurements (preliminary: two pairs)Five planned pairs were paused after two complete pairs to diagnose the scaling failure. These are wall times; each startup had one excluded cold Q1-Q22 pass. No spilling was observed in either retained cold or scored pass. Two pairs do not establish performance acceptance.
The small-footprint queries Q2 and Q11 still improve by about 66% and 70%. Large lineitem scans do not receive the same cache benefit. This is consistent with the directly observed Q6 admission failure. Other query-specific differences have not been independently attributed. Limits and next design requirementMore warmups do not repair FIFO history starvation. Increasing the SQL spill threshold fixed the invalid spilling setup but cannot repair decoded-cache admission. The 16 GiB payload cache also cannot hold an entire SF100 multi-column workload: Q6 alone reports 15.65 GiB of decoded InputSize before allocator overhead. Fixing history alone must not blindly admit a full oversized scan and recreate the earlier large-scale cache churn. Admission must preserve a bounded useful subset and recognize recurrence over a longer scan, while respecting the same configured memory limit and adding no cache tier. The original 32 GiB application / 2 GiB aggregate-spill-threshold attempt is INVALID because spilling occurred; its timings and resource-exhaustion error are excluded from acceptance and regression claims. Server129 has not been used for this diagnosis. |
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 81dc205861d95334ee36a3ad2f830eb1770634d0
Assessment: request_changes
The design appropriately reuses existing reservation and FIFO owners. Validated remote-cache reads bypass the new no-eviction mode and require an integration fix. The recorded acceptance of the 1.89% SF1000 slowdown is preserved.
Model: gpt-6.1-sol / max
Session: 01a1a004-9884-72c0-ad39-f096c4209c4a · slot 1 · generation 0
- P2
pkg/vm/engine/readutil/reader.go:1035: A late persisted read carries MemoryCacheNoEvict and receives a validated remote-cache hit while the destination memory cache is full.
Impact: RemoteCache.Read uses the ordinary MemCache allocator, which evicts resident data before conditional publication. Late remote hits can therefore replace the resident working set despite the new policy.
Evidence: cache.go:118-120 assigns the remote allocator to MemCache; remote_cache.go:171 bypasses allocatorForDecode. The LocalFS.Read probe fails resident preservation on the candidate (remote-cache-probe-v2.jsonl). Routing that copy through the entry-selected allocator passes both preservation and ordinary-read controls (remote-cache-control-retry.jsonl). Apply this routing and extend the existing remote-reservation test.
Validation:
-
Preflight, native build, frozen-source/delta and formatting checks passed; source remained unchanged.
-
All 10 new tests passed under race; the complete fifocache race suite passed. The candidate diagnostic reproduced the defect, and the allocator-routing control passed.
-
Reused frozen-head build, UT, SCA and compose BVT CI. All 12 discussion entries were reconciled; 11 terminal receipts match retained logs and inputs in validation-index.json.
Limitations:
-
The full fileservice race run timed out; a focused retry timed out during build/link. Complete package race validation and adaptive stress remain incomplete locally.
-
Remote transport was mocked. Performance evidence was reused as reported, including the accepted SF1000 slowdown and unresolved SF100 signals.
|
Fixed the validated remote-cache allocation-policy bypass in
Merged authoritative main Validation:
The recorded SF1000 measurements and the requester's acceptance remain historical evidence. This update adds no new TPC-H run or performance claim; the earlier performance comments remain unchanged. |
|
The current versioned design includes the integration with main's reference-owning S3-FIFO and the validated remote-hit allocator routing. The PR description is unchanged; the fix and validation record is appended separately. Review has been re-requested from XuPeng-SH. |
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: c6855c678ce17c9d71cbd7c0142181009b398e52
Assessment: approve
The remote-cache allocation bypass is resolved. Late reads reserve unused backing capacity and publish through existing S3-FIFO ownership and queue semantics without eviction; ordinary reads retain replacement behavior. The added accounting and allocation modes are justified by pending and pinned-buffer lifetimes. The recorded performance tradeoff remains accepted.
Model: gpt-6.1-sol / max
Session: 01a1a004-90c3-73b1-acc9-3d4636452003 · slot 0 · generation 0
Validation:
-
Reviewed all 17 changed files, affected allocation/publication/conversion owners, related issue #30849 and every discussion entry. Saved the change map, ownership audit and exact-once discussion assessment.
-
Local isolation preflight and frozen-source, whitespace, gofmt and discussion/CI identity checks passed; receipts and retained logs are reconciled in validation-ledger.json.
-
Frozen-head CI reports successful shared build, UT, SCA, coverage and compose BVT. Considered the current-head author's normal/race and 100-repeat remote/publication reports, with source verification of their policy and cleanup oracles.
Limitations:
-
No local Go tests completed: the default Go 1.26.6 rejected the required 1.27.1, and the explicit toolchain download timed out before compilation. Author raw execution logs were not supplied.
-
Remote transport is mocked. Historical SF1000 paired Total slowdown of 1.89% and unresolved SF100 signals remain recorded; requester acceptance is preserved. No fresh performance qualification of the new base is claimed.
✅ Merged into
|
What type of PR is this?
Which issue(s) this PR fixes:
Related to #30849.
What this PR does / why we need it:
Persisted readers stop retaining decoded columns after a fixed scan-position threshold. Permit late reads to fill unused decoded-cache capacity on their first touch, while preventing their decode-buffer allocation from evicting resident data. Keep ordinary early reads and S3-FIFO replacement behavior unchanged.
Reserve actual allocator backing bytes before conversion. Account for pending fills and live buffers still held after eviction until their final release. When capacity is unavailable or pressure is active, decode transiently and prevent later rehoming into an eviction-capable allocation. Conditional publication rechecks capacity and pressure using ordinary S3-FIFO queue placement without eviction.
Carry the allocation mode through local, S3, disk-cache conversion and byte-decoding paths, preserving explicit write suppression, destination ownership and shared-decode policy separation. Known capacity refusal bypasses allocator/pressure locks and avoids advertising a memory fill that cannot publish; pending fills can still accept joins, disk publication remains independent, and transient conversion sharing remains available.
Review status
Ready for review at the requester's direction on 2026-11-08. The acceptance decision and benchmark evidence are recorded in comments. Earlier performance criteria and unresolved signals below remain available for review.
Prior readiness verification (2026-11-04)
The user updated the criterion on 2026-11-04: no confirmed query or Total regression is sufficient; a confirmed speedup is not required. Correctness, resource bounds, no-spill SF100 checks and applicable scale controls remain required.
dbf3efd4b5merged without conflicts; full local pre-push checks passed before this update.Design
The approved design is versioned here. This revision keeps the existing decoded cache, reader threshold and S3-FIFO algorithm.
Validation
Performance evidence
New performance results will be appended as separate comments.