kv-routing-sim

Which KV-cache routing policy should you run, and on how many GPUs? This simulator answers that. Its cache model was checked against a live vLLM, and its tests were written down before they ran.

Run it on your own traffic Explore the results

Keep each user on one GPU. This holds on three calibrations of the same GPU type (a T4). Session-sticky routing needs the fewest GPUs, or ties for the fewest, at every load, with one shared system prompt and with four. It never needs more GPUs than round-robin or least-loaded. With 64 tenants' prompts, it is not settled whether routing by prefix saves GPUs. The registered test said no on two calibrations and yes on one. Another calibration usually gives a count within one GPU of each count shown here.

This is not a new result. SMetric (Wang et al., arXiv 2607.08565, July 2026) reached the same advice from production traces on 32 real GPUs. LMetric (Zhang et al., OSDI '26) showed why a hand-set weight between cache and load has no right value. What is here is an independent agreement on a small calibrated model, from tests registered before they ran. Both published policies were then ported and run here on a public production trace. Under a first-token target, neither needed more GPUs than session-sticky. SMetric's rule needed one fewer at the highest load on three calibrations of four, and LMetric on one. SMetric also names a weakness that these grids cannot show. Real sessions differ a lot in size, and plain session-sticky routing then leaves the load unbalanced. Every generated session here has the same number of turns. NVIDIA's Dynamo ships a larger simulator for the same question (AISim). Three more simulators checked against live engines were published in October and November 2026. The related-work section of the README names them and says what earlier checks missed.

Distinct system promptsWorking set ÷ one T4's cache Fewest T4s that hold a 2 s p95 time-to-first-token at 2 sessions/s, on calibrations A · B · C
10.06session-sticky 5 · 5 · 5 · round-robin 7 · 7 · 7 · balanced prefix-affinity (load weight 16) 10 · not held on 16 · not held
64 offered, 48 used2.66session-sticky 10 · 12 · 10 · balanced prefix-affinity (load weight 16) 10 · 10 · 10 · round-robin 16 · 16 · not held (prefix-affinity, load weight 1: 8 · 7 · 8, a weight found after the tests)

Scope, before you trust it. Generated agent traffic, Qwen3-4B, and T4 timings from a context-aware model. That model predicted held-out traffic within 1.41×, and two live T4s within 1.02–1.79×. The target on this page is on the first token only. With a limit on the time per token as well (100 ms), which kvsim replay applies by default, the simulator needs about twice as many GPUs. Its per-token model was checked on a live T4: within 7% on three workloads around that limit, on one replica. This finding changed three times. On the first timing model, which had no context term and was 5–222× optimistic on live GPUs, prefix routing won once prompts outgrew one GPU's cache. Tested again on the validated model (calibration A), that half was falsified. On two more calibrations of the same GPU type (B and C, measured with kvsim calibrate on a live engine), it held. Then a defect of the simulator's engine was found and fixed (release 0.2.0), and with the fixed engine it holds on B and fails on C. Where all three calibrations give a GPU count (91 of 144 points), they agree within one at 86, and that half of the finding is decided by up to two GPUs. At 9 more points they disagree on whether the target can be held at all. The explorer below shows calibration A. On Mooncake's real traces, run again on the validated model on two calibrations, session-sticky and prefix-affinity are within one replica of each other at every speed.

Checked against a live vLLM

vLLM 0.30.0, Qwen3-4B (fp16), and a small cache of 512 blocks, chosen so that it overflows. Each workload ran three times, and the predictions were committed before the run. The numbers in the table are prefix-cache hit rates.

WorkloadLive engineBlock-pool modelPlain LRU
One at a time, 1-token outputs0.60900.6090 · exact0.6073
One at a time, 64-token outputs0.48830.4883 · exact0.6073
Concurrent, under preemption0.50760.509 (+0.3%)0.6073 (+19.7%)

Hit rate = vllm:prefix_cache_hits ÷ vllm:prefix_cache_queries, two counters. The cached-token count of every request matched too.

The timing model is context-aware, for a T4, and fitted on micro-benchmarks. It predicted held-out traffic within 1.41×, where the first model (no context term) was up to 7× optimistic. Every number on this page uses it.

Explore the precomputed results

Loading the grid…

Run it on your own traffic

Open the simulator in your browser to size a fleet for generated traffic or your own serving log, on the measured T4 or on your GPU's profile. The file you choose is read on your computer and never uploaded.

Or install the command line:

pip install kv-routing-sim
kvsim replay your-trace.jsonl --policies all --replicas 1-16 \
  --profile t4-qwen3-4b-vllm0.30.0-ctx --cost-model default