Set up KV Cache Offloading
KV cache offloading lets a worker keep more KV cache than fits in GPU memory by spilling blocks to host (CPU) memory or local disk. This serves longer contexts and reuses cached prefixes across requests. This page shows how to turn it on inside a DynamoGraphDeployment (DGD) — the engine-internals and local-CLI details live in the per-backend pages linked at the end.
This is a how-to for an existing deployment. If you have not authored a DGD yet, start with the DGD Guide.
The pattern
Offloading is configured on the worker, not the Frontend. For vLLM workers, pass a --kv-transfer-config JSON argument that names and configures the connector:
Choose a connector
Each offloading backend uses the same --kv-transfer-config hook with a different kv_connector. Pick one — they are alternatives, not layers.
SGLang HiCache does not use the --kv-transfer-config connector mechanism. On an SGLang worker, set --enable-hierarchical-cache in args and DYN_SHARED_CACHE_TYPE in the container env. See Using HiCache.
Configure LMCache on a vLLM worker
This aggregated vLLM worker uses LMCache to offload KV blocks to 20 GB of host memory:
Two things to size together:
lmcache.max_local_cpu_sizesets the host-memory cache size in GB for each worker.resources.limits.memorymust hold the LMCache tier and the engine’s normal host-memory footprint.
Use LMCache’s persistent L2 adapters when the deployment needs a storage tier beyond host memory.
Related pages
These cover engine internals, the local-CLI workflow, and tuning for each backend:
- Deploy LMCache MP — full LMCache MP deployment walkthrough (operator,
LMCacheEngine, worker). - Local KV Cache Offloading — compare the available backends and run their local examples.
- Using HiCache — SGLang hierarchical cache.
- Publish KV Events — publish KV events from a custom engine.