Interactive engineering lab

Prefix cache trap: a session burst, LRU eviction and a session cap

Prefix cache trap: a session burst, LRU eviction and a session cap. Vary load, KV pool, burst and a session cap in a seeded serving model.

By Sandeep Belgavi · Published 2026-11-10

Synthetic fixtures computed locally. No model, serving engine or production service is contacted.

Experiment workspace

Decision trace

    The question this experiment answers

    Geetha's team at Belgavi's Book Store serves a help-desk model to agent sessions that call tools between turns. A follow-up turn is cheap only if the session's prefix is still in the KV cache. Can the same arrival rate be healthy or stuck depending only on whether a burst happened, and does a cap on concurrent sessions prevent or end the stuck state? Change the load, the pool, the burst and the cap, and watch the hit fraction per five-minute window.

    Change one assumption at a time

    Start from burst_200 and set the cap to 40: the trap never forms. Set Engage the cap at (s) to 1800 and the cap rescues an established trap; raise the cap to 50 and it does not, because 50 sessions need more KV than the pool holds. In rate_04_burst_10 raise the burst to 20 and the run tips into the trap. Raise the pool to 600000 in burst_200 and the trap still forms. In burst_200 lower the arrival rate to 0.15, below the all-miss capacity, and set the horizon to 7200: the trap drains on its own, but only after about an hour of zero hits.

    Expected outcomes

    steady_no_burst: about 0.997 of follow-up turns hit and 27 sessions remain at the end. burst_200: every window after the burst has 0 hits and 1,339 sessions are in the system at the end. burst_200_cap_40: no trap, mean client wait 46 s. burst_200_cap_40_at_1800: the last window is back to 0.972, with 605 sessions paused at the client along the way. burst_200_cap_50_at_1800: still trapped, last window 0.232. rate_04_burst_10: no trap; rate_04_burst_20: trapped. bigger_pool_burst_200: trapped. overload_rate_07: trapped without any burst. The capacities are 1.245 sessions per second when follow-ups hit and 0.209 when every turn misses.

    Read the table and the trace

    The metrics show completed sessions, the follow-up hit fraction overall and in the last window, sessions in the system and waiting at the client at the end, paused sessions, the mean wait at the client and the two capacities. The table lists each five-minute window with its follow-up turns, hit fraction, completions and the longest queue. The trace marks the burst, the moment the cap is engaged, the first window where reuse is lost and the window where it returns.

    Reset and export

    Reset inputs restores the selected preset and recomputes. Export JSON downloads the inputs, every window, every trace step, the metrics and the stated limits.

    Limits

    A toy model, not the engines in arXiv 2611.08902: one server prefills one turn at a time, decode and batching are folded into a fixed overhead, every session has the same turn count and prompt growth, eviction is LRU over whole sessions, and a turn hits only when its whole previous KV is resident. It reproduces the feedback loop and the effect of a cap; its numbers are not predictions for any real engine or GPU.

    Views are my own and do not represent any employer, past or present.