[GH-ISSUE #1920] Prompt-cache checkpoint pool: two alternating long conversations evict each other and both re-read from token 0 every turn (no batch-groups) #757

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

Originally created by @xingyun618 on GitHub (Oct 11, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/1920

Engine version

0.1.42 (compiled from main for sm_70, CUDA 12.0, Linux)

Hardware

1x Tesla V100-SXM2-32GB, 23 GB system RAM, i5-8400 (6 cores)
Model: Qwen3.8-Flash-Next IQ2_XS, low-RAM resident mode, --max-context 262144 --kv q4_0

What happened

Two Hermes agent conversations share one Strata server. Both grew to ~170K tokens.
While both were active, every turn of both conversations re-read the whole prompt
(~145 s per turn at ~1190 tok/s), even though the engine kept writing checkpoints:

strata serve: prompt 175141 tokens = 172470 reused + 2671 read in 3770 ms (708.5 tok/s), ... 6 checkpoints
strata serve: prompt 173168 tokens = 0 reused + 173168 read in 146196 ms (1184.5 tok/s), ... 12 checkpoints
strata serve: prompt 681 tokens = 0 reused + 681 read in 1327 ms (513.1 tok/s), ... 1 checkpoints
strata serve: prompt 176636 tokens = 0 reused + 176636 read in 148586 ms (1188.8 tok/s), ... 12 checkpoints

The alternating short request is the third conversation (a tool-call turn, ~600 tokens).
No skip parking lines in the log (conversation-cache parking never engaged; this is
the --prompt-cache checkpoint pool, not the parked-session tier).

Diagnosis

With the default --prompt-cache-every 16384, a ~170K conversation wants ~11-12
checkpoints of its own. Two such conversations need ~24 slots but the pool is 6 by
default (I raised it to 12, then 16): each turn rewrites its own 12 checkpoints and
evicts the other conversation's, so neither finds a matching prefix on its next turn
and both re-read from token 0. The N checkpoints counter stays healthy — it counts
writes, not reuse — which is what makes this easy to miss.

Single-conversation use is fine (reuse 99.9%, 1-2 s per turn on ~890-token deltas);
it only collapses when two long conversations alternate. This looks like the same
family as #1604 (checkpoint pool starvation with more than one conversation) but
without --batch-groups involved — plain serial serving, one slot.

Workaround applied

--prompt-cache 16 --prompt-cache-every 32768 (a ~170K conversation then wants ~6
checkpoints, so 16 slots hold both). I have not yet measured the steady state after
the change; will report back.

Suggestion

When the pool is too small to hold the checkpoints of the conversations that were
active in the last N turns, consider a cheaper retention policy: keep the FIRST
checkpoint of each conversation (the system-prompt root, --prompt-cache-root
already exists) even when the tail checkpoints of that conversation are evicted, so
an alternating long conversation at least reuses the root instead of re-reading from
token 0. A one-line log when a checkpoint write evicts another conversation's newest
checkpoint would also make this diagnosable from the log alone.

Thanks for the engine — the resident low-RAM mode runs IQ2_XS at 68-88 tok/s on this
V100 box, which is genuinely remarkable for a 23 GB RAM machine.

Originally created by @xingyun618 on GitHub (Oct 11, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/1920 ### Engine version 0.1.42 (compiled from main for sm_70, CUDA 12.0, Linux) ### Hardware 1x Tesla V100-SXM2-32GB, 23 GB system RAM, i5-8400 (6 cores) Model: Qwen3.8-Flash-Next IQ2_XS, low-RAM resident mode, `--max-context 262144 --kv q4_0` ### What happened Two Hermes agent conversations share one Strata server. Both grew to ~170K tokens. While both were active, **every turn of both conversations re-read the whole prompt** (~145 s per turn at ~1190 tok/s), even though the engine kept writing checkpoints: ``` strata serve: prompt 175141 tokens = 172470 reused + 2671 read in 3770 ms (708.5 tok/s), ... 6 checkpoints strata serve: prompt 173168 tokens = 0 reused + 173168 read in 146196 ms (1184.5 tok/s), ... 12 checkpoints strata serve: prompt 681 tokens = 0 reused + 681 read in 1327 ms (513.1 tok/s), ... 1 checkpoints strata serve: prompt 176636 tokens = 0 reused + 176636 read in 148586 ms (1188.8 tok/s), ... 12 checkpoints ``` The alternating short request is the third conversation (a tool-call turn, ~600 tokens). No `skip parking` lines in the log (conversation-cache parking never engaged; this is the `--prompt-cache` checkpoint pool, not the parked-session tier). ### Diagnosis With the default `--prompt-cache-every 16384`, a ~170K conversation wants ~11-12 checkpoints of its own. Two such conversations need ~24 slots but the pool is 6 by default (I raised it to 12, then 16): each turn rewrites its own 12 checkpoints and evicts the other conversation's, so neither finds a matching prefix on its next turn and both re-read from token 0. The `N checkpoints` counter stays healthy — it counts writes, not reuse — which is what makes this easy to miss. Single-conversation use is fine (reuse 99.9%, 1-2 s per turn on ~890-token deltas); it only collapses when two long conversations alternate. This looks like the same family as #1604 (checkpoint pool starvation with more than one conversation) but without `--batch-groups` involved — plain serial serving, one slot. ### Workaround applied `--prompt-cache 16 --prompt-cache-every 32768` (a ~170K conversation then wants ~6 checkpoints, so 16 slots hold both). I have not yet measured the steady state after the change; will report back. ### Suggestion When the pool is too small to hold the checkpoints of the conversations that were active in the last N turns, consider a cheaper retention policy: keep the FIRST checkpoint of each conversation (the system-prompt root, `--prompt-cache-root` already exists) even when the tail checkpoints of that conversation are evicted, so an alternating long conversation at least reuses the root instead of re-reading from token 0. A one-line log when a checkpoint write evicts another conversation's newest checkpoint would also make this diagnosable from the log alone. Thanks for the engine — the resident low-RAM mode runs IQ2_XS at 68-88 tok/s on this V100 box, which is genuinely remarkable for a 23 GB RAM machine.
Author
Owner

@xingyun618 commented on GitHub (Oct 11, 2026):

Update: root cause found, and it is not the checkpoint count

I first blamed --prompt-cache pool exhaustion (6 slots vs. two ~170K conversations).
Raising the pool to 16 and widening the interval to 32K did not fix it — a
conversation that came back after the other one had run still read from token 0.
The real cause is that the conversation (parking) cache is disabled by default
(--conversation-cache-mib 0), so checkpoints rotate out of the bounded
--prompt-cache pool and each alternating conversation re-reads everything.

Fix that works

Added to the engine arguments:

--conversation-cache-mib 5120 --conversation-cache-slots 3 --conversation-cache-min-free-mib 1024

Measured on the same box (1x V100-SXM2-32GB, 23 GB RAM, IQ2_XS low-RAM resident,
262144 context, --kv q4_0), two conversations of ~176K tokens alternating
(A1 B1 A2 B2):

turn before after
A1 (first read) 148 s 145 s
B1 (first read) 148 s 147 s
A2 (alternating return) 148 s 7.2 s
B2 (alternating return) 149 s 6.4 s

Engine log for the returning turns:

strata serve: prompt 176194 tokens = 172032 reused + 4162 read in 6618 ms, 7 checkpoints
strata serve: conversation cache: parked 176228 tokens in 1349.1 ms; parked=1 bytes=2538864016 evictions=0
strata serve: conversation cache: restored 172032 tokens (checkpoint) in 291.5 ms; parked=1 bytes=4129157512

97.6% of the prompt reused, restore in ~290 ms, and evictions=0 — both parked
conversations fit. Steady-state RAM for two parked 176K conversations: ~4.3 GiB
against the 5 GiB budget, on a machine where the engine itself holds ~17.5 GiB RSS.

Why this is easy to miss

  • The default (--conversation-cache-mib 0) is documented, but the symptom —
    healthy-looking N checkpoints counters on every request, while reuse is 0 —
    looks like a checkpoint-pool sizing problem, not a missing tier.
  • The checkpoint counter counts writes, not reuse, so the log looks fine while
    every turn re-reads from token 0.
  • On a low-RAM box the RAM cost of parking (~25 KB/token here, so ~2.5 GiB for a
    176K conversation) is a real budget question, so raising --prompt-cache first
    feels like the cheaper lever. It is not a substitute.

Suggestion

  • In the log line that reports the prompt read, include the reuse ratio and which
    tier served it (live session / parked conversation / checkpoint / root / none).
    That single addition would have pointed at the missing parking tier immediately
    instead of at the checkpoint count.
  • Consider naming the symptom in the docs section on multiple conversations: if
    reused is always 0 while N checkpoints is non-zero, the pool is rotating,
    not undersized.

Still a great engine — the resident low-RAM mode runs this at 68-88 tok/s on a
23 GB machine. Thanks.

<!-- gh-comment-id:6105402675 --> @xingyun618 commented on GitHub (Oct 11, 2026): ### Update: root cause found, and it is not the checkpoint count I first blamed `--prompt-cache` pool exhaustion (6 slots vs. two ~170K conversations). Raising the pool to 16 and widening the interval to 32K did **not** fix it — a conversation that came back after the other one had run still read from token 0. The real cause is that the conversation (parking) cache is disabled by default (`--conversation-cache-mib 0`), so checkpoints rotate out of the bounded `--prompt-cache` pool and each alternating conversation re-reads everything. ### Fix that works Added to the engine arguments: ``` --conversation-cache-mib 5120 --conversation-cache-slots 3 --conversation-cache-min-free-mib 1024 ``` Measured on the same box (1x V100-SXM2-32GB, 23 GB RAM, IQ2_XS low-RAM resident, 262144 context, `--kv q4_0`), two conversations of ~176K tokens alternating (A1 B1 A2 B2): | turn | before | after | |---|---|---| | A1 (first read) | 148 s | 145 s | | B1 (first read) | 148 s | 147 s | | A2 (alternating return) | 148 s | **7.2 s** | | B2 (alternating return) | 149 s | **6.4 s** | Engine log for the returning turns: ``` strata serve: prompt 176194 tokens = 172032 reused + 4162 read in 6618 ms, 7 checkpoints strata serve: conversation cache: parked 176228 tokens in 1349.1 ms; parked=1 bytes=2538864016 evictions=0 strata serve: conversation cache: restored 172032 tokens (checkpoint) in 291.5 ms; parked=1 bytes=4129157512 ``` 97.6% of the prompt reused, restore in ~290 ms, and `evictions=0` — both parked conversations fit. Steady-state RAM for two parked 176K conversations: ~4.3 GiB against the 5 GiB budget, on a machine where the engine itself holds ~17.5 GiB RSS. ### Why this is easy to miss - The default (`--conversation-cache-mib 0`) is documented, but the symptom — healthy-looking `N checkpoints` counters on every request, while reuse is 0 — looks like a checkpoint-pool sizing problem, not a missing tier. - The checkpoint counter counts writes, not reuse, so the log looks fine while every turn re-reads from token 0. - On a low-RAM box the RAM cost of parking (~25 KB/token here, so ~2.5 GiB for a 176K conversation) is a real budget question, so raising `--prompt-cache` first feels like the cheaper lever. It is not a substitute. ### Suggestion - In the log line that reports the prompt read, include the reuse ratio and which tier served it (live session / parked conversation / checkpoint / root / none). That single addition would have pointed at the missing parking tier immediately instead of at the checkpoint count. - Consider naming the symptom in the docs section on multiple conversations: if `reused` is always 0 while `N checkpoints` is non-zero, the pool is rotating, not undersized. Still a great engine — the resident low-RAM mode runs this at 68-88 tok/s on a 23 GB machine. Thanks.
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:6270698605 --> @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#757
No description provided.