LMCache is a high-performance KV cache layer that supercharges LLM serving by enabling prefill-once, reuse-everywhere semantics. As described in the official documentation, LMCache lets LLMs prefill each text only once by storing the KV caches of all reusable texts, allowing reuse of KV caches for any reused text (not necessarily prefix) across any serving engine instance.
This document describes how LMCache is integrated into Dynamo’s vLLM backend to provide enhanced performance and memory efficiency.
Dynamo’s vLLM runtime expects LMCache to be present in the same Python environment. On supported environments (x86_64, Python 3.10-3.13, PyTorch built against CUDA 12.x), the published wheel installs directly:
LMCache only publishes x86_64 manylinux wheels linked against CUDA 12. For aarch64 hosts, or hosts running PyTorch built against a different CUDA major version, build LMCache from source against your matching torch + CUDA stack — see the official LMCache installation guide.
Compatibility note
LMCacheMPConnectorneeds the fix from LMCache#3282, which is on LMCachemainbut not yet released. Without it, the MP path fails on vLLM ≥ 0.20.0 (including thevllm==0.21.0Dynamo currently pins) withRuntimeError: Unsupported GPUKVFormat: 7— vLLM 0.20+ uses GPU KV formats 6 / 7 that the MP path doesn’t yet handle.Until the next LMCache release, build LMCache from source against that PR.
LMCache runs the cache engine as an out-of-process sidecar (lmcache server); the Dynamo worker connects to it via the LMCacheMPConnector. Start the sidecar, then launch the worker:
The LMCache MP server is configured via CLI arguments. See the Configuration Reference for the full list of lmcache server flags.
LMCache MP uses a two-tier storage architecture: an in-memory L1 cache (sized with --l1-size-gb) plus optional persistent L2 adapters configured with --l2-adapter. The supported L2 storage backends are:
Use the provided launch script for quick setup:
This will:
LMCacheMPConnector connected to the sidecarIn aggregated mode, the system uses:
LMCacheMPConnectorkv_both (handles both reading and writing)Disaggregated serving separates prefill and decode operations into dedicated workers. This provides better resource utilization and scalability for production deployments.
Use the provided disaggregated launch script (requires at least 2 GPUs):
This will:
NixlConnector only for KV transfer between prefill and decode workersMultiConnector with both LMCache and NIXL connectors. This enables prefill worker to use LMCache for KV offloading and use NIXL for KV transfer between prefill and decode workers.--disaggregation-mode prefillThe system automatically configures KV transfer based on the deployment mode and worker type:
Argument Parsing (args.py):
Engine Setup (main.py):
Sidecar Lifecycle (launch script):
lmcache server process before the Dynamo workerChunk Size Tuning: Pass --chunk-size to lmcache server based on your use case:
Memory Allocation: Set --l1-size-gb on lmcache server conservatively:
Workload Optimization: LMCache performs best with:
The LMCache MP server records metrics through the OpenTelemetry SDK and exposes them on its own HTTP admin port (default :8080/metrics), prefixed lmcache_mp_:
vLLM and Dynamo metrics remain on Dynamo’s :8081/metrics (set DYN_SYSTEM_PORT=8081 on the worker to enable that endpoint).
For detailed information on LMCache metrics, including the complete list of available metrics and how to access them, see the LMCache Metrics section in the vLLM Prometheus Metrics Guide.
Found PROMETHEUS_MULTIPROC_DIR was set by uservLLM v1 uses prometheus_client.multiprocess and stores intermediate metric values in PROMETHEUS_MULTIPROC_DIR.
PROMETHEUS_MULTIPROC_DIR yourself, vLLM warns that the directory must be wiped between runs to avoid stale/incorrect metrics.PROMETHEUS_MULTIPROC_DIR internally to a temporary directory to avoid vLLM cleanup issues. If you still see the warning, confirm you are not exporting PROMETHEUS_MULTIPROC_DIR in your shell or container environment.lmcache server CLI arguments