[GH-ISSUE #2923] [Bug] conversation cache skips snapshot restore under RAM pressure: parked -> next request does a full 310-372K re-prefill (4/4), same sequence recovers normally when RAM is plentiful #1178

Closed
opened 2026-11-04 01:49:07 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @xzphot on GitHub (Oct 17, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/2923

All numbers below are from a single production log (strata-iq3_s.log, v0.1.44) over 2026-10-17, quoted verbatim.

Related: #2228 (coarse-checkpoint fallback for a fast client — same family, mild form: 6.8K-47K re-reads; this report is the heavy form with a RAM-pressure variable), #2316 (slow replay on cache hit), #2409/#2408 (restore-path OOMs).

One more observation: the leftover reused value is always exactly 16384 — the default --prompt-cache grid step — which matches #2228's 32,768-grid finding (their rig sets --prefill auto:32768). So under RAM pressure the engine seems to fall back to the first grid checkpoint (or skip restore entirely) and re-prefill everything since.

Environment

  • Strata v0.1.44, win32, 79.9 GB physical RAM, RTX 3090 24 GB
  • Single client (one ZCode window), single long session, port 8080
  • Flags: --max-context 524288 --kv int8 --conversation-cache-mib 12288 --conversation-cache-slots 3 --conversation-cache-min-free-mib 2048
  • Session grew 321K → 388K tokens over ~2.5 hours of continuous agent work

Symptom

4 times tonight, the first request after a successful parked did not recover the snapshot and instead did a full re-prefill (310K–372K tokens read, 233–285 s at ~1300 tok/s):

prompt 325540 tokens = 325109 reused + 431 read ... 3129 generated
conversation cache: parked 328669 tokens in 2278.5 ms; parked=2 bytes=11511460824 evictions=42
prompt 330755 tokens = 16384 reused + 314371 read in 233714 ms (1345.1 tok/s), 195 generated   <-- full re-read
conversation cache: skip parking (physical RAM admission; need 5613 MiB plus 2048 MiB floor, 5840 MiB available)
conversation cache: restored 325535 tokens (checkpoint) in 1227.0 ms
prompt 328860 tokens = 325535 reused + 3325 read in 6281 ms   <-- normal

The re-read request is just snapshot + ~2K new tokens (330755 = 328669 + 2086), so the recovery path should have hit. Same pattern at 335593 (cancelled after 233 s re-read), 336411, and 388629:

conversation cache: parked 386540 tokens in 1338.4 ms; parked=1 bytes=6735893912 evictions=48
prompt 388629 tokens = 16384 reused + 372245 read in 284937 ms (1306.4 tok/s)   <-- full re-read
conversation cache: skip parking (snapshot 6457 MiB exceeds available budget)

All 4 re-reads follow a parked within one log line. Zero re-reads happened in any other situation tonight.

Control group (same day, ~8 hours earlier, RAM not yet tight)

Same sequence — parked, then next request — recovers and hits normally even at 449K tokens:

conversation cache: parked 449168 tokens in 2936.3 ms; parked=1 bytes=7692905940 evictions=4
prompt 448985 tokens = 442368 reused + 6617 read in 8979 ms (737.0 tok/s)   <-- recovered, normal

Restore latency comparison, same magnitude snapshots:

RAM state restore tokens
plenty 134.9 ms 69583
plenty 477.6 ms 285205
tight 20481.9 ms 332285
tight 5187.7 ms 386625

So under RAM pressure snapshots page out, and the engine appears to skip the recovery path entirely and re-prefill from scratch — 4-5 minutes instead of seconds.

Secondary observation

--conversation-cache-mib 12288 cannot hold two snapshots of a 380K-token session (7.0–7.7 GB each):

conversation cache: parked 386540 tokens ... bytes=6735893912
conversation cache: skip parking (snapshot 6457 MiB exceeds available budget)

Question

Is skipping recovery under RAM pressure intentional (avoid page-in death spiral), or should the engine prefer restoring the snapshot? Even with a slow page-in (~5-20 s), restoring beats a 285 s re-prefill by an order of magnitude. Either way, a log line explaining why recovery was not attempted would help diagnosis.

Also: is 12 GB a reasonable default budget for --conversation-cache-mib on a 79.9 GB machine running ~400K-token sessions, given one snapshot alone is 7+ GB?

Originally created by @xzphot on GitHub (Oct 17, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/2923 > All numbers below are from a single production log (`strata-iq3_s.log`, v0.1.44) over 2026-10-17, quoted verbatim. Related: #2228 (coarse-checkpoint fallback for a fast client — same family, mild form: 6.8K-47K re-reads; this report is the heavy form with a RAM-pressure variable), #2316 (slow replay on cache hit), #2409/#2408 (restore-path OOMs). One more observation: the leftover `reused` value is always exactly **16384** — the default `--prompt-cache` grid step — which matches #2228's 32,768-grid finding (their rig sets `--prefill auto:32768`). So under RAM pressure the engine seems to fall back to the first grid checkpoint (or skip restore entirely) and re-prefill everything since. ## Environment - Strata v0.1.44, win32, 79.9 GB physical RAM, RTX 3090 24 GB - Single client (one ZCode window), single long session, port 8080 - Flags: `--max-context 524288 --kv int8 --conversation-cache-mib 12288 --conversation-cache-slots 3 --conversation-cache-min-free-mib 2048` - Session grew 321K → 388K tokens over ~2.5 hours of continuous agent work ## Symptom 4 times tonight, the first request after a successful `parked` did **not** recover the snapshot and instead did a **full re-prefill** (310K–372K tokens read, 233–285 s at ~1300 tok/s): ``` prompt 325540 tokens = 325109 reused + 431 read ... 3129 generated conversation cache: parked 328669 tokens in 2278.5 ms; parked=2 bytes=11511460824 evictions=42 prompt 330755 tokens = 16384 reused + 314371 read in 233714 ms (1345.1 tok/s), 195 generated <-- full re-read conversation cache: skip parking (physical RAM admission; need 5613 MiB plus 2048 MiB floor, 5840 MiB available) conversation cache: restored 325535 tokens (checkpoint) in 1227.0 ms prompt 328860 tokens = 325535 reused + 3325 read in 6281 ms <-- normal ``` The re-read request is just snapshot + ~2K new tokens (`330755 = 328669 + 2086`), so the recovery path should have hit. Same pattern at 335593 (cancelled after 233 s re-read), 336411, and 388629: ``` conversation cache: parked 386540 tokens in 1338.4 ms; parked=1 bytes=6735893912 evictions=48 prompt 388629 tokens = 16384 reused + 372245 read in 284937 ms (1306.4 tok/s) <-- full re-read conversation cache: skip parking (snapshot 6457 MiB exceeds available budget) ``` All 4 re-reads follow a `parked` within one log line. Zero re-reads happened in any other situation tonight. ## Control group (same day, ~8 hours earlier, RAM not yet tight) Same sequence — parked, then next request — recovers and hits normally even at 449K tokens: ``` conversation cache: parked 449168 tokens in 2936.3 ms; parked=1 bytes=7692905940 evictions=4 prompt 448985 tokens = 442368 reused + 6617 read in 8979 ms (737.0 tok/s) <-- recovered, normal ``` Restore latency comparison, same magnitude snapshots: | RAM state | restore | tokens | |---|---|---| | plenty | 134.9 ms | 69583 | | plenty | 477.6 ms | 285205 | | tight | 20481.9 ms | 332285 | | tight | 5187.7 ms | 386625 | So under RAM pressure snapshots page out, and the engine appears to skip the recovery path entirely and re-prefill from scratch — 4-5 minutes instead of seconds. ## Secondary observation `--conversation-cache-mib 12288` cannot hold two snapshots of a 380K-token session (7.0–7.7 GB each): ``` conversation cache: parked 386540 tokens ... bytes=6735893912 conversation cache: skip parking (snapshot 6457 MiB exceeds available budget) ``` ## Question Is skipping recovery under RAM pressure intentional (avoid page-in death spiral), or should the engine prefer restoring the snapshot? Even with a slow page-in (~5-20 s), restoring beats a 285 s re-prefill by an order of magnitude. Either way, a log line explaining *why* recovery was not attempted would help diagnosis. Also: is 12 GB a reasonable default budget for `--conversation-cache-mib` on a 79.9 GB machine running ~400K-token sessions, given one snapshot alone is 7+ GB?
Author
Owner

@saffyk1 commented on GitHub (Oct 17, 2026):

why dont you try

in args

"--resident-budget-gib",
"36" <--- you can play with this value based on your card and ram

with

in env

"STRATA_UNBUFFERED_LOAD": "1"

and this will give you enough ram only slightly decreasing the first token speed but it will pick up gradually

<!-- gh-comment-id:6236364741 --> @saffyk1 commented on GitHub (Oct 17, 2026): why dont you try in args "--resident-budget-gib", "36" <--- you can play with this value based on your card and ram with in env "STRATA_UNBUFFERED_LOAD": "1" and this will give you enough ram only slightly decreasing the first token speed but it will pick up gradually
Author
Owner

@Niko1221 commented on GitHub (Oct 19, 2026):

Thanks for taking the time to report this.

We're resetting the tracker for 0.2.0-beta. There are more than 1,300 open issues and pull requests, too many for us to read properly, so we're closing everything that isn't being worked on right now. Closed here does not mean rejected.

To reopen it takes about two minutes:

  1. Re-test on 0.2.0-beta. It may already be fixed. Write down what you see.
  2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other].
  3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system.
  4. Comment /reopen. A check runs and either reopens the issue or lists what is still missing.

The rules are in CONTRIBUTING.md.

<!-- gh-comment-id:6271364493 --> @Niko1221 commented on GitHub (Oct 19, 2026): Thanks for taking the time to report this. We're resetting the tracker for 0.2.0-beta. There are more than 1,300 open issues and pull requests, too many for us to read properly, so we're closing everything that isn't being worked on right now. Closed here does not mean rejected. To reopen it takes about two minutes: 1. Re-test on 0.2.0-beta. It may already be fixed. Write down what you see. 2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other]. 3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system. 4. Comment `/reopen`. A check runs and either reopens the issue or lists what is still missing. The rules are in [CONTRIBUTING.md](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#1178
No description provided.