CacheRoute: Planned Prefix-Affinity Routing for Large-Scale LLM Serving
Organizations: Meta, Menlo Park, California, USA
Abstract
Prefix caching avoids prefill only when a repeated request returns to a server that still holds the prefix KV. Cache-blind balancing disperses that reuse; fixed affinity preserves it but can overload a server. CacheRoute resolves this tradeoff with a periodic routing plan. It admits high-rate keys to a stable warm set and places their assignments by expected load. Hot keys may use more than one destination, although every key in our primary semi-synthetic aggregate uses exactly one. On Llama-3.3-70B in fp8 across 60 H100 GPUs, CacheRoute sustains 176+/-11 QPS at a 3.5-s p99 SLO, 2.3x the strongest of five baselines. Served KV-cache hit rate rises from 64.1+/-1.3% under cache-blind balancing to 93.2+/-0.5%. A second semi-synthetic aggregate and controlled 8B and burst experiments separate the effects of affinity and placement. Two 32B workloads provide the counterexamples: when affinity recovers too little KV work, its residual load skew reduces or erases the improvement. We therefore recommend gating any deployment with a shadow replay rather than enabling affinity from workload statistics alone.
Figures & tables
| Policy | KV hit | [email protected] | Cap.@5s | p99@100 |
|---|---|---|---|---|
| Flat-LB | % | 80 | 5.7s | |
| Sticky | % | 30 | 8.5s | |
| CHWBL | % | 3.8s | ||
| DualMap | % | 5.3s | ||
| Preble | % | 140 | 3.8s | |
| CacheRoute | % | 180 | 1.8s |
| Policy | top- 128 | top- 256 |
|---|---|---|
| Flat-LB | 30 | 30 |
| Sticky | 30 | 60 |
| CHWBL | 100 | 60 |
| DualMap | 100 | 100 |
| Preble | 60 | 60 |
| CacheRoute | 100 | 160 |
| top- | Flat-LB | Sticky | CHWBL | DualMap | Preble | CacheRoute |
|---|---|---|---|---|---|---|
| 16 | 500 | 100 | 500 | 100 | 500 | 500 |
| 32 | 500 | 100 | 360 | 100 | 360 | 500 |
| 64 | 500 | 160 | 360 | 160 | 360 | 500 |
| 128 | 240 | 240 | 360 | 360 | 360 | 500 |
| 256 | 160 | 240 | 240 | 360 | 360 | 500 |
| 2000 | 100 | 360 | 160 | 360 | 160 | 360 |
| Configuration | KV hit | Imbalance | Capacity |
|---|---|---|---|
| Flat-LB | % | 240 | |
| affinity | % | 240 | |
| replication | % | 240 | |
| LPT (full) | % | 500 |
| Regime | Flat hit | Aff. hit | Cap. mult. | Result |
|---|---|---|---|---|
| 8B synthetic whales | 9.3% | 77.0% | 2–6 | win |
| Aggregate A–32B | 1.1% | 11.8% | 0.50–0.67 | lose |
| Aggregate B–32B | 0.8% | 8.5% | 1.0 | tie |
Appendix figures & tables10 assets
Supplementary material from the paper’s appendix.
Appendix
| Property | Measured value |
|---|---|
| Distinct business keys | 128,824 |
| Traffic Gini coefficient | 0.756 |
| Top-key share | |
| Top 4% share | |
| Multi-turn request share | 80.8% |
| Mean requests per thread | 2.64 |
| Study | Model/precision | Destinations | Workload | Repetitions | Evidence class |
|---|---|---|---|---|---|
| Primary six-policy | Llama-3.3-70B/fp8 | 30 TP2 (60 H100) | primary aggregate, top- 128 | seeds 2–6 ( ) | HW/core |
| Wide active set | Llama-3.3-70B/fp8 | 30 TP2 (60 H100) | primary aggregate, top- 256 | seeds 2–9 ( ) | HW/core |
| Second distribution | Llama-3.3-70B/fp8 | 30 TP2 (60 H100) | independent aggregate, | seeds 2–4 | HW/core |
| Precision pressure | Llama-3.3-70B/fp16 | 30 TP2 (60 H100) | primary aggregate | seeds 2–4 | HW/supporting |
| 8B six-policy/ablation | Llama-3.1-8B/bf16 | 30 MP1 (30 H100) | aggregate or injected whales | seeds 2–4 | HW/mechanism |
| Burst–Gamma | Llama-3.3-70B/fp8 | 30 TP2 (60 H100) | marginal CV=1.9 | seeds 2–6 | HW/sensitivity |
| Policy | Served KV hit | [email protected] |
|---|---|---|
| Flat-LB | 0 | |
| Sticky | 0 | |
| CacheRoute | 0 |
| Policy | KV hit | [email protected] | Cap.@5s |
|---|---|---|---|
| DualMap | 60% | 60 | 100 |
| CacheRoute | 82% | 80 | 120 |
| Flat-LB | CacheRoute | |||
|---|---|---|---|---|
| Arrival | Cap. | KV | Cap. | KV |
| Poisson | 30 | 64% | 180 | 94% |
| Gamma, CV=1.9 | 30 | 63% | 160 | 90% |
| Flat-LB | CacheRoute | |||
|---|---|---|---|---|
| Arrival | Cap. | KV | Cap. | KV |
| Poisson | 60 | 66% | 180 | 93% |
| Gamma, CV=1.9 | 60 | 66% | 180 | 93% |
| Trace blocks, CV=2.73 | 0 | 67% | 180 | 93% |
| Transition | Cache churn | Count churn | KV loss | p99 loss | Warmup dip |
| (points) | (ms) | (points) | |||
| 92.5% | 1.6% | 0.1 | 15.6 | ||
| 94.5% | 0.0% | 3.0 | 11.4 | ||
| 98.0% | 1.6% | 13.8 | |||
| Mean | 94.5% | 1.1% | 1.0 | 13.6 |
| Axis | Setting | KV (CR/flat) | CR cap. | Mult. |
|---|---|---|---|---|
| 50 QPS | 360 | |||
| 100 QPS | 360 | |||
| 200 QPS | 360 | |||
| 500 QPS | 360 | |||
| Injected skew | 5% head | 500 | ||
| Injected skew | 15% head | 500 |
| Representative scenario | KV (CR/flat) | Result | |
|---|---|---|---|
| 8 | 2 [email protected] | 45%/12% | tail/KV only |
| 30 | 8 [email protected] | 70%/14% | |
| 60 | 16 [email protected] | 32%/24% | no win |
| KV hit | [email protected] | Cap.@5s | |||
|---|---|---|---|---|---|
| Regime | flat | affinity | flat | CR | flat/CR |
| Aggregate A–32B | 1.1% | 11.8% | 20 | 10 | 30/20 |
| Aggregate B–32B | 0.8% | 8.5% | – | – | 20/20 |
LLM Inference
Large language model inference studies how models generate outputs efficiently, reliably, and securely across hardware and workloads.
See all 280 papers