Case file: PR #705 — "fix(selene,helios): stop service_store and CompositeStore Retry(Slabs) CPU storm"
Refs #703. Base main, head eec5e95, opened 2026-12-03, ready for review, no labels, no reviews, no comments, no CI.
Key findings
- The perf claim has no served-workload evidence. The only profile is issue #703's capture on the pre-fix
flare 0.5.1binary, and #703 itself says the storm was not reproduced on v0.5.3. There is no before/after CPU%, noperfsample on the patched build, no latency measurement. Charter line 11 requires exactly this: "Performance PRs need benchmarks showing an actual speedup overmainon a served workload (#210)". Evidence shipped instead: 9 unit tests, author-reported full-suite counts, clippy/rustfmt clean — all debug profile only. - One cited mechanism is overstated. The body says "
Worker::run(helios/src/server/runtime.rs:1214,1257-1290) enforces a 2 ms idle poll cap so theretry_afterexpiry edge fires reliably". In code,idle_wait()(helios/src/server/runtime.rs:1269-1292) returns 50 µs when a store inbound transfer or scheduler inbound waiter exists, 100 µs when an incoming awaits the pool, and 2 ms only in the final fallback; the whole branch runs only whenexecutor.outstanding() == 0(runtime.rs:1248-1263). With GPU work outstanding the loop doesexecutor.park()/spin_loop()/yield_now(), andRankExecutor::park()returnsfalseimmediately on discrete GPUs and non-Linux hosts (helios/src/execution/transport.rs:862-871, "preserve minimum-latency spin-yield polling"). So there is no 2 ms cap on loop cadence while a step is in flight; the worker still spin-yields by design — #705 removes the per-iteration store work, not the spin. - The reported top hotspot is left untouched. #703's profile attributes 13.12% of samples to cloning the 154,510-element
page_snapshot_refsinsideexport_fits()(helios/src/scheduler/cache_memory.rs (not opened)). That is #703 fix direction (4) and the PR declares it out of scope, though itscan_retry_slabsgating does avoid callingexport_fits()for unready slab retries (runtime.rs:2880-2891). - Metric semantics change with no doc update.
StoreStats::progressunder ENOSPC,held[0]cadence, and deferredSlabsattempt counts all shift (the PR's own "Narrow Metric and API Shifts" section).docs/prefix-cache-offload.md:293-297still states the old worker contract ("Retryaccepts no copy. The worker retains only checkpoint IDs for retries after store progress…"), and theheld/ENOSPC description at :1364-1372 and :503-504 still describes the pre-PR behavior.pr_fileslists only the 6 code files — no docs change. - Undeclared changes ride along. An existing test assertion was relaxed to accommodate the new
spill()guard (selene/src/composite.rs:2733-2736:store.spill(child.key).unwrap()becameif !store.parked[&child.key].writing { … }), anddisk_stored()now silently removes an orphanedparkedentry — a latent-panic fix (composite.rs:661-664). Neither is listed as a change; the body's test section mentions only the 9 new tests. - Two large open PRs rewrite the same code with no merge order recorded — #674 and #694 (both yatesdr, COLLABORATOR). #694 edits the same
StoreOutcomematch inservice_store(to handle a newUnprofitablevariant) and adds anotherHostStoremethod next tocan_retry_slabs. pr_diffoverstates the scope through mirror base drift. The whole-PR diff additionally shows AGENTS.md, docs/, flare-cli/ andpreserve_message_anchorhunks; these are content of #687/#689/#690/#697 merged into real main after this mirror'smain(cc0a49d). Verified independently (nopreserve_message_anchoron mirror main; old CUDA_HOME text at AGENTS.md:461-469). Authoritative scope =pr_files: 6 files, +820/−71.
The change
Size and file map (pr_files): selene/src/composite.rs +519/−50, helios/src/server/runtime.rs +89/−21, helios/src/server/runtime/phase_tests.rs +196/−0, selene/src/pool/local.rs +6, selene/src/pool/store.rs +4, selene/src/store.rs +6 — total +820/−71, matching the description.
Mechanism, as verified at pr/705:
Worker::service_store(helios/src/server/runtime.rs:2791-2957) now builds oneVec<PendingStore> { publication, prior_retry, fresh }(2791-2795), deduplicatingscheduler.take_publications()byCheckpointIdthrough aHashMap<CheckpointId, usize>(2800-2819); a duplicate ID replaces the earlier publication and setsfresh = true.deferred_stores.drain(..)(2822-2843) recordsprior_retry = Some(reason)for IDs already present, otherwise re-fetches fromscheduler.publication(id), queues it asfresh: falsewhenretryis set, or parks it inwaiting(deduped byseen_waiting); a missing publication countshost_retry_abandoned[reason].deferred_copyoutsare deduped againstpublication_index,seen_waitingandseen_copyouts(2853-2873), withprev_deferred_copyoutsused to count only new headroom deferrals (2891-2899).- Non-fresh retries with
prior_retry == Some(Slabs)and!store.can_retry_slabs(&publication)are requeued intowaitingandcontinuebeforeexport_fits()(2880-2888); everything else goesexport_fits()→pin_checkpoint→store.store(). progressis now set only onQueued(2930), a changed reason (prior_retry != Some(reason), 2933-2935), any other Ok outcome includingOversize/Presentvia_ => { progress = true; }(2941-2943), copyout headroom change (2895), or a storeErr(2953). Previously it was unconditional.host_retry_successis now credited wheneverprior_retry.is_some()(2947-2951) instead of scanning the drainedretry_ids— more accurate for the fresh+deferred collision case, asserted byfresh_and_deferred_collision_with_progress_processes_once_and_credits_retry_success(phase_tests.rs:9146-9158).HostStore::can_retry_slabs(&self, _checkpoint) -> booldefaulttrue(selene/src/store.rs:324-330), implemented with real logic inCompositeStore(selene/src/composite.rs:1405-1457: returnstrueearly for un-ready tails, existing outbound/disk/memory keys, covered chains, fitting records, thinnable rows, or no spillable slots; otherwisewriting < MAX_SPILLS && covered_slots < short && !backoff_active()), forwarded byPooledStore(selene/src/pool/store.rs:615-616) andTiers(selene/src/pool/local.rs:45-48), inherited byMemoryStore.CompositeStore::disk_storednow returns whether waiters should reconsider:falseon ENOSPC backoff,truewhenever a write slot is freed, including whenoutboundwas already gone — in which case the orphanedparkedentry is removed (composite.rs:652-688).poll()clearsretry_afterand does onestats.progress += 1when the 50 ms timer expires (composite.rs:1658-1659), after ENOSPC completion re-parks withwriting = false, a freshOutbound, andretry_after = retry_now() + 50 ms(composite.rs:665-688);held[0]is still incremented once per ENOSPC completion at :667.spillable_slots()(full scan) →has_spillable_slots(need)(early exit, composite.rs:774); newwriting_spills()withdebug_assert!1:1 invariant betweenDiskJob::Writeandparked.writing(composite.rs:752-771);spill()early-returns whileparked.writing(composite.rs:819-821) and whilebackoff_active()(composite.rs:815-817);spill_parked()skips atMAX_SPILLS(composite.rs:892) and no longer re-sortswaiting_spills()per rejection (composite.rs:884-911).CompositeStore::store()'sRetry(Slabs)branch skipsspill_parked()whenwriting_spills().0 == MAX_SPILLS(composite.rs:1371-1381).- Test-only injectable clock:
#[cfg(test)] test_now: Option<Instant>andpoll_at()wrapper (composite.rs:130-131, 221-241), absent from release builds.
What the description does not say: the relaxed existing test assertion (composite.rs:2733-2736); the new debug_assert! invariants in shipped code (composite.rs:752-771); the latent-panic fix on orphaned parked entries (composite.rs:661-664); and that retry_after now also gates spill()/spill_parked() directly, not only poll() (composite.rs:815-817, 892) — previously a store() rejection could start a spill during ENOSPC backoff. poll()'s maintenance gate also loses its || retry disjunct, so a maintenance pass runs once per 50 ms expiry rather than per event.
What the description says that the code does not: the "2 ms idle poll cap" (Key finding 2).
The why
The driver is issue #703 (open, jcartu, opened 2026-12-03 09:50, same day as the PR; labels area:caching, area:memory, area:selene, bug, performance, triage:investigate). Labels bug/performance and the same-author, same-day timing mean the "want" is one day old at intake, not long-standing.
#703's evidence — all author-captured on flare 0.5.1, 4× RTX PRO 6000 Blackwell SM120, DeepSeek-V4.1-Flash TP4, 154,510 KV pages, --max-concurrency 64 --prefix-cache-memory 8G --prefix-cache-disk … --prefix-cache-disk-limit 100G:
- Prometheus at uptime 5,171 s:
flare_host_cache_slots_in_use 13,884 / 16,973,intake_slots 3,072(17 usable slots above intake),outbound_in_flight 8(=MAX_SPILLS),parked_records 3,853,store_reasons_total{reason="slabs"} 1,185,546,store_skipped 1,185,872,held_total{tier="dram"} 3,188,096. perf2 s @ 99 Hz (202 samples, all on the singleflare-modelthread): 88.51%flare-cli, 10.21% libc; hottest clusters mapped heuristically tohelios/src/scheduler/cache_memory.rs(not opened) (13.12%) andhelios/src/cache.rs(not opened) (11.34%).- Follow-up comment (2026-12-03 11:40): the real trigger was the
--prefix-cache-diskvolume at 100% (ENOSPC, 2.8 MiB free) withdisk_bytes 25.65 GiBreserved but zero durable records (durable = false,clean_slots = 0) becauseDiskStore::reserve_capture(..., reserve = true, ...)inserts unready pinned records at copy-to-DRAM time. - Stated limitations: single production observation, no minimal reproduction, not reproduced on v0.5.3, perf attribution from
.rodatastrings in a stripped release binary, counters are lifetime totals over 5,171 s.
Which of #703's four suggested directions #705 takes: (1) progress only on transitions — done; (2) gate/bound deferred slab retries without starving smaller publications — can_retry_slabs; (3) avoid spill_parked() while writing == MAX_SPILLS — done; (4) stop cloning the 154k page_snapshot_refs in export_fits() — not done, out of scope (and it is the largest hot cluster in the issue's own profile).
Prior art for the same failure class: #358 "Honor the pool refusal retry backoff and count refusal discards" (merged 2025-11-18, yatesdr, follow-up to #338, part of #335), which introduced refused_until = now + 50 ms so pool events cannot shorten a refusal backoff. #705's backoff_active()/retry_after gating on the local-disk path is the analogous guard.
Related work
- #694 "selene,helios: add write-side NVMe and pool spill profitability gate" (open, yatesdr, head 432d009, +22806/−3875, 52 files, stacked on #674) — selene/src/composite.rs +3026/−78, helios/src/server/runtime.rs +403/−106, selene/src/store.rs +177/−10. Adds
StoreOutcome::Unprofitableand aHostStoremethod (compacted), handles outcomes in the sameservice_store()match #705 edits, and rewrites theRetry(Slabs)branch inCompositeStore::store. Note #705's new_ => { progress = true; }wildcard (runtime.rs:2941-2943) would also swallowUnprofitable. - #674 "selene,selene-manager,helios: improve prefix-cache hit rate, L1 retention, NVMe throughput, and GPU snapshot packing" (open, yatesdr, 2026-12-02, head ec2e3db, +11419/−1237, 42 files) — touches selene/src/composite.rs, helios/src/server/runtime.rs, selene/src/store.rs (adds
begin_lookup,StoreStatsreserved/rate fields,worth_restore) anddocs/prefix-cache-offload.md. Its own review flagged overlap with #665/#659; neither #674 nor #694 mentions #705, and no merge order is recorded anywhere. - #497 "Reduce disk offload restore latency and integrated-memory intake overhead" (merged 2026-11-29, FujitsuPolycom, +1809/−360) — its What section shortened
Worker::idle_waitfrom 2 ms to 50 µs during inbound restores; #705 cites that exact region as its cadence guarantee. #497's reviewer twice wrote that "a completion wakeup would remove the poll instead of tuning it" (helios/src/server/runtime.rs:1187-1195) — an acknowledged open design thread #705 leans on rather than resolves. - #697 (merged 2026-12-03) and #690 (merged 2026-12-03, jcartu) — relevant only as the base-drift content
pr_diffmis-attributes to #705. - Park/spill/park-metric lineage: #141, #142, #168, #337, #413, #415, #429, #610, #607 — explains why
parked,spill_parked,held[0]andwaiting_spills()look as they do. None is undone or reversed by #705. - Checked and not material: #691, #692 (same author, helios/server metrics), #693 (scheduler pricing), #704/#686/#688 (docs/manifest), #416, #455, #504, #524, #609, #155, #92, #101, and #698/#576/#548/#549/#560/#554/#621/#334/#301/#483 (other
runtime.rssubsystems: startup ordering, thread pinning, metrics, scheduler admission).
Recent activity
- Commit-level history is unavailable in this mirror (
search_historyfails with "Could not read c513e46a…"), so activity was reconstructed from PR metadata. helios/src/server/runtime.rs's idle/wake path was just rewritten by #497 (merged 2026-11-29) — see above. Other runtime.rs changes since 2026-11-24: #697, #663, #628, #626, #620, #619, #615, #607, #579, #505, #507, #497. #705's head already contains #697, so it is current with the latest merged runtime.rs change.- Last merged functional changes in the exact selene area: #610 (yatesdr) and #607 (lukealonso).
MAX_SPILLS = 8and the 50 ms backoff are long-standing constants untouched by #705. - No commit on the default branch since the PR branched (cc0a49d) touches its changed files, per the orientation packet — no textual conflict in the mirror yet, but see the #674/#694 overlap above for logical conflict.
People
- Author: jcartu, CONTRIBUTOR. Last 180 days: 6 merged, 3 closed, 10 open. Merged work touched docs (5), helios/src (4), root (1), flare-cli/src (1), heliopause/src (1) — mostly docs and helios, not selene internals. #705 is their first change to the selene cache core. In flight: #703 (this issue), #691/#692 (helios/server metrics), #693 (scheduler pricing), #688 (manifest messages), #704/#686 (docs).
- selene/src/composite.rs ownership: 18 of the 20 most recent PRs touching it are yatesdr's (COLLABORATOR) — #168, #142, #141, #155, #413, #415, #429, #504, #524, #610, #674, #694 and older. lukealonso authored #607 and #626/#620/#619/#579 on the helios side. This is a standing fact for reviewers, not a judgement on the PR.
- Engaged so far: nobody.
pr_comments→ "No comments." No reviews, no labels, no reactions. Noflare-autobotcase file or Review has been posted on #705, unlike #690/#697/#694 where the bot posted within hours. - Author signs "Discord: jcartu"; issue #703 signs the same.
Community
Zero engagement: no comments, no reviews, no labels, no CI checks on head eec5e95, hours old at intake. Interest drawn so far: none.
Project fit
- The body has the charter's required four parts (why / what changed / claimed result / evidence), which matches the expected PR description shape.
- Aligned: the work sits squarely in the charter goal "Store prefix-cache checkpoints in host memory and share them across Flare instances via Selene" (charter line 24). No per-model branch, no new flag, no magic default added — the knob is a trait method defaulting to
true, so "keep the runtime small and model-agnostic" is respected. Shared code (selene store + helios worker) is the right layer for the bug. - Tension: "Bring real evidence. Performance PRs need benchmarks showing an actual speedup over
mainon a served workload (#210). Bug fixes need to address the root cause; don't just swallow, skip, or retry an unexplained error (#397)." #705 is a performance-titled PR with no served-workload number, and it deliberately skips retries that cannot progress (can_retry_slabs,spill_parked()skip atMAX_SPILLS) — though it keeps the deferred publication parked inwaitingrather than dropping it, and explains the cause in #703. The ENOSPC root cause (a full disk) is explicitly declared out of scope. - Footprint vs "smallest footprint in shared code": +820/−71 in shared selene/helios code plus ~715 lines of tests and a new public trait method.
Claims and evidence
Backed, verified in the tree:
- 5 new tests in selene/src/composite.rs (
no_space_spill_failure_does_not_advance_progress_while_dram_saturated,enospc_retry_after_expiry_wakes_sole_deferred_store_deterministically,disk_stored_returns_true_when_write_job_removed_without_outbound,slab_retry_while_spills_saturated_does_not_inflate_held,can_retry_slabs_skips_unfit_large_publications_without_starving_small_ones), around composite.rs:6295-6634, all present and consistent with the implementation. - 4 new tests in helios/src/server/runtime/phase_tests.rs (~9021-9207) with a
FakeStorewhosecan_retry_slabsconsults aretry_slabs_readyset (phase_tests.rs:2222-2226). - The trait addition and its forwarding (store.rs:324-330, pool/store.rs:615-616, pool/local.rs:45-48).
- Caveat on determinism: the body promises "zero sleeps", but
enospc_retry_after_expiry_wakes_sole_deferred_store_deterministicallystill contains a 10-second wall-clockwhile Instant::now() < deadline { … thread::yield_now(); }loop, even though its comment says "no sleeps!".
Author-reported, not confirmable from the repository:
- Test totals 558 selene / 1906 helios (84 ignored) / 255 flare / 246 flare-cli, and "0 clippy warnings, 0 rustfmt diffs". No CI ran on
eec5e95("no checks"). Everything is debug-profile only — no release-profile numbers, unlike #497/#697 which report release runs.
Not backed / overstated:
- The headline ("stop … CPU storm") — no served-workload benchmark, no post-fix profile, no reproduction on a released version (charter #210).
- The "2 ms idle poll cap" (Key finding 2).
- "
held[0]… inflating per rejected publication" is asserted from reading the code (spill_parkedaddsparked.len() - writingwhenwriting == MAX_SPILLS && covered < need), not measured. - The issue's
parked_records == held[0]puzzle was resolved inside #703 by the ENOSPC finding and is not re-derived here.
Reach
- Who: anyone running tiered host prefix caching under saturation or
ENOSPC(the #703 config:--prefix-cache-memory 8G --prefix-cache-disk … --prefix-cache-disk-limit 100G,--max-concurrency 64). - Config/defaults: none changed. No new flag, key, dependency, wire/protobuf or on-disk format change, no selene-manager protocol change, rank-relay/multi-host paths untouched.
MAX_SPILLS(8) and the 50 ms backoff stay as-is. - API:
can_retry_slabsis a new method on the publicflare_selene::HostStoretrait with a body returningtrue, so out-of-tree implementors compile unchanged and behave as before. In-tree implementors:CompositeStore(real logic),PooledStore/Tiers(forwarding),MemoryStore(default), plus test doublesFakeStore/OrderStore(helios/src/server/phase_tests.rs:2126 (not opened), 2519).spillable_slots()was private and had no external caller. - Operators: dashboards/alerts built on #703's numbers (
store_reasons_total{reason="slabs"},store_skipped,held_total{tier="dram"},retry_success) will read differently; fewer attempts are submitted at all, andheld[0]is now accounted per progress-gatedpoll()tick. - Docs: not updated — see Key finding 4.
- Test surface:
#[cfg(test)] test_now/poll_atseam is compile-time-absent in release builds, which is cleaner than #497'sHashFaultseam its review flagged.
Process
Open and declared "ready for review", opened and last updated the same day (2026-12-03), 6 files +820/−71, no labels, no reviews, no comments, no CI ("no checks") on head eec5e95, no bot case file. Too young to show a review-latency pattern.
Open questions / could not be found
- No served-workload before/after measurement exists anywhere in the tree or the PR — would the mechanism-level tests plus a
perfrerun on the patched binary suffice for #210? - Merge order vs #674/#694 is unrecorded, and both rewrite the same
Retry(Slabs)branch, the sameservice_storeoutcome match and the sameHostStoretrait. Whether #705 rebases onto them is unstated. - Whether
held[0]'s new cadence and the ENOSPCprogressedge are acceptable to whatever consumes those metrics (no owner or alert definition found in the repo). - Whether the docs (
docs/prefix-cache-offload.md) update is expected in this PR or a follow-up — the author neither claims nor excludes one. - Commit-level history and CI logs for this mirror were unavailable (
search_historyerrors; "no checks"), so the full-suite and clippy numbers could not be independently confirmed.