On this page
To keep the KV cache across a restart, store it in a tier that lives outside the inference engine's process (a disk directory, a remote store or object storage) and start the restarted engine with the same cache identity, so it finds and reloads those blocks instead of recomputing them.
Why does a restart empty the KV cache?
Engines cache prompt prefixes in GPU memory and, optionally, in host memory. Both belong to the engine process. A deploy, a config change, a crash, a node drain or a spot reclaim ends that process, and the cache goes with it.
For short prompts that costs little. For long system prompts, tool lists, shared documents and agent histories, the first minutes after every restart run at cold-start speed, often exactly when traffic is shifting between replicas. Background: what a KV cache is and how offloading works.
What are the options for keeping the KV cache across restarts?
Each option below moves cached blocks somewhere an engine restart does not touch. Each row summarises the project's own documentation as of November 2026. Where a project does not state its restart behaviour, we say so: we have not tested the other options ourselves.
- Restart reuse not stated
vLLM native tiers
Built in:
fsandobjtiers of the offloading connector- How it attaches
- Built-in
OffloadingConnectorwith the tiering spec, vLLM 0.22 and later - Where the cache lives
- Files under a root directory, in a subdirectory named from the model and a digest of the run configuration; or an S3-compatible bucket through NIXL
- What it needs
- A disk or bucket, the same configuration after the restart so the digest matches, and your own clean-up of old directories
- After an engine restart
- The files stay and the same configuration maps to the same directory. The docs do not describe reuse after a restart.
- Depends on the backend
SGLang HiCache L3
Built in:
--hicache-storage-backend- How it attaches
- File, Mooncake, 3FS, NIXL, AIBrix or a dynamic class
- Where the cache lives
- L1 GPU and L2 host memory are private to the instance; L3 is the chosen backend (the file backend defaults to node-local
/tmp/hicache) - What it needs
- A backend that keeps data outside the process, and a host pool large enough to stage what is read back
- After an engine restart
- Only what the L3 backend keeps. L1 and L2 are lost.
- Restart reuse not stated
LMCache with a remote backend
LMCache connector in vLLM
- How it attaches
remote_urlsuch asredis://,lm://ormooncakestore://- Where the cache lives
- CPU memory, then local storage, then the remote service
- What it needs
- The remote service running before vLLM starts, as the docs say
- After an engine restart
- The remote copy is outside the engine process, so it can outlive a restart while the service keeps its data (for Redis, its own persistence settings).
- Stated: survives restarts
PegaFlow
Sidecar process with a vLLM connector; SGLang also named
- How it attaches
- An independent sidecar beside the engine
- Where the cache lives
- Host memory or SSD; RDMA for sharing across nodes
- What it needs
pegaflow-llmfrom PyPI and the sidecar running beside the engine- After an engine restart
- Its README states "KV cache survives engine restarts".
- Stated: survives restarts
Lifeboat Cache
Plugin for vLLM 0.32 and later, or a HiCache dynamic backend
- How it attaches
- A secondary tier of vLLM's offloading connector, or a dynamic backend for SGLang
- Where the cache lives
- Local disk by default (
~/.lifeboat_cache/kv), also NFS, ONTAP or S3; compressed to FP8 by default - What it needs
- The
lifeboatcachepackage, under a proprietary licence - After an engine restart
- Its package page states "Persisted KV survives restarts" and reports measurements after a full restart; the index is rebuilt from disk at startup.
- Restart reuse not stated
Mooncake Store
Connectors in vLLM, SGLang and LMCache
- How it attaches
- A
mooncake_masterplus clients that contribute memory - Where the cache lives
- DRAM pooled across store clients; optional SSD offload, off by default
- What it needs
- The master (etcd for high availability) and the clients running
- After an engine restart
- Data held by clients outside the engine is not tied to it. The docs call a master without high availability a single point of failure.
- Measured: survives
KVStash
Separate daemon under SGLang and vLLM; adapters on PyPI
- How it attaches
- SGLang HiCache storage tier; vLLM KV connector
- Where the cache lives
- A separate daemon: DRAM, then NVMe, then S3
- What it needs
- The daemon (a free download from the install page), a private network, a namespace and a bearer token
- After an engine restart
- Everything in the daemon survives an engine restart: measured below. A daemon restart keeps the NVMe tier and loses blocks held only in DRAM.
Two differences matter more than the brand.
- Who owns the index. Blocks on disk are only useful if the restarted engine or store can find them again.
- Who evicts. A directory nobody cleans up fills the disk, which is why llm-d pairs a shared filesystem tier with a separate evictor, while stores such as Mooncake and KVStash evict on their own.
What does keeping the cache save after a restart?
We measured it with SGLang's own load generator. The SGLang server was stopped and started again between passes while the KVStash daemon kept running. Both setups have SGLang's GPU radix cache and host-memory HiCache; the second also has KVStash as the storage tier.
9.02 s→0.80 s
p99 time to first token in the first pass after an SGLang restart
- Mean
- 3.08 s to 0.34 s
- Prompt reused
- 54% to 99%
- Input throughput
- 3.1x
| Setup | Mean | p50 | p99 | Input tokens/s | Prompt reused |
|---|---|---|---|---|---|
| SGLang cache | 3.08 s | 2.94 s | 9.02 s | 19,939 | 54% |
| SGLang cache + KVStash | 0.34 s | 0.32 s | 0.80 s | 60,835 | 99% |
FIGURE 2. First pass after an SGLang server restart, concurrency 16. Full study.
- SGLang bench_serving, generated shared-prefix workload: 8k-token prefixes, 128 groups x 4 questions, 512 requests per pass.
- One L40S, Qwen2.5-7B-Instruct BF16, SGLang host-memory pool 48 GB, KVStash response budget raised, store on the same host.
- SGLang cache = GPU radix cache + host-memory HiCache.
- One pass per row, 29 Oct 2026.
- KVStash: 0 misses, 0 aborts in every pass.
The reuse in the SGLang cache row comes from requests in the same pass that share a prefix: after the restart, the first request for each prefix recomputes it and later ones hit the fresh GPU cache. With KVStash, the first request for each prefix also reads it back.
Failure cases matter as much as the speed-up
- Store killed mid-load: 512/512 requests completed; SGLang recomputed. The engine falls back to recompute instead of failing requests.
- Empty store after a restart: requests served; cache refilled (64/64, 75% reuse).
- Store crash during writes: Daemon killed with SIGKILL during a write storm, 100 loops: 0 corrupt and 0 phantom blocks over 18,160 acknowledged writes. Linux crash-test harness; every acknowledged write either survived recovery byte-identical or was reported gone.
- One GPU per server, one model (Qwen2.5-7B BF16), 8k-token generated prefixes, store on the same host over loopback TCP, one pass per row.
- On an H100 with 30k-token prefixes the gain was smaller: mean 6.35 s to 2.53 s, p99 12.54 s to 4.66 s, 81% of prompt tokens reused. The misses after that restart were capacity evictions, not errors.
Checklist: keeping the KV cache across restarts in production
Put stable content first.
Reuse needs an exact prefix from the first token, in whole blocks or pages (64 tokens in our SGLang setup). System prompt, tool definitions and shared documents go first; per-user text goes last. A timestamp or request ID at the top defeats every option above.
Keep the cache identity fixed.
Model and revision, KV precision, page or block size, parallelism, tokenizer, chat template and rope scaling must match, or the cached bytes are wrong for the model. Give each identity its own namespace or directory. A good store treats a mismatch as a miss; KVStash's correctness run included a wrong model identity and every case behaved correctly (r20261029-correct1).
Run the cache outside the engine's lifecycle.
A separate process, and on Kubernetes a separate pod or node service, so a rolling deploy of the engine does not take the cache with it.
Size capacity from bytes per token.
One 8,192-token prefix of Qwen2.5-7B in BF16 is about 470 MB. Multiply by the distinct prefixes you want to keep warm, plus room for what each pass writes. On SGLang, also size the host pool that stages reads (see below).
Warm up deliberately.
After deploying a new model identity the store is empty for it. Replay your most common prefixes before moving traffic, or accept one cold pass.
Plan for the cache being unavailable.
The engine must treat a missing or unreadable block as a miss and recompute. Kill the store during a load test and confirm every request completes.
Watch hits, misses and evictions.
Alert when the hit rate falls after a deploy: it usually means the identity or the prompt prefix changed. Compare p99 time to first token before and after restarts.
Treat the cache like the prompts.
Cached keys and values are derived from user content. Keep the store on a private network, authenticate clients and separate tenants.
On SGLang, size the host poolIn our SGLang load test, a 16 GB host-memory pool held reuse at 33-45% even though KVStash reported 0 misses; with a 48 GB pool and nothing else changed, reuse reached 99%. SGLang stages everything it reads from a storage tier through that pool. (L40S, 8k-token prefixes, 512 requests per pass, 29 Oct 2026.)
Frequently asked questions
Does vLLM keep its prefix cache after a restart?
Not by itself. vLLM's prefix cache lives in GPU memory and its CPU offload tier lives in host memory owned by the engine process, so both are gone when the process exits. To keep the cache you need a tier outside the process: vLLM's filesystem or object tiers, LMCache with a remote backend, or a separate KV-cache store such as PegaFlow, Lifeboat Cache, Mooncake or KVStash.
Does SGLang HiCache survive a restart?
Its L1 (GPU) and L2 (host memory) tiers do not: SGLang's docs say they are private to a single inference instance. Only the L3 storage backend can outlive the process, and only if that backend keeps its data, for example a file directory on disk or an external store that keeps running.
What happens if the cache store restarts, not the engine?
It depends on the store. With KVStash, blocks held only in DRAM are lost when the daemon restarts, blocks on the NVMe tier are recovered from its on-disk log, and blocks held only in S3 are currently treated as misses after a daemon restart. In every case the engine recomputes what it cannot read. We tested an empty store after a restart: requests were served and the cache refilled.
Can I reuse the cache after upgrading the model?
No. Keys and values depend on the exact weights, so a new model revision, a different KV precision, page size or parallelism layout needs a fresh cache. Use a new namespace or directory per model identity and let the old one age out.
How do I check that reuse after a restart is working?
Watch three things in the first minutes after the restart: the store's hit and miss counters, the share of prompt tokens the engine reports as cached, and p99 time to first token compared with the same traffic before the restart. If there are no hits, the usual causes are a changed cache identity, a token or namespace mismatch, or a prefix that changed at the start of the prompt.
Does this help autoscaling and spot instances too?
Yes, for the same reason: a new or replacement server that reads from a shared store starts with the cache other servers built. Three SGLang servers on one H100 machine sharing one KVStash on the same host (no network between them): the two servers reading what the first computed got 1.8-1.9x requests per second and 4x lower p99 TTFT, 98.5% of prompt tokens cached, 0 errors. With too little store memory they fell back to normal speed without errors (run r20261029-shared3b).