LMCache remote storage plugin for KVStash
The lmcache-kvblockd package lets LMCache use KVStash as a remote storage backend. It is tested in CI against the real lmcache package; it is not yet qualified on GPUs.
- Status
- Path exists
- Adapter
- lmcache-kvblockd
- Interface
- Remote storage plugin
- Tested on
- LMCache 0.5.6 (not recommended), in CI
- GPUs
- Not yet qualified
Last updated
Status, plainly
The path works end to end on CPU. It has not passed a GPU run, so treat it as a preview.
- Built (done) On PyPI, requiring lmcache 0.5.1 or later and below 0.6.
- Tested in CI (done) Registration test through the real lmcache package, and a CPU end-to-end run with vLLM and a live daemon.
- Qualified on GPUs (not done) Not yet. Our GPU runs so far needed a patched LMCache build.
- Numbers published (not done) None. We publish no LMCache numbers until the GPU runs pass.
Use the native connector. It needs no LMCache and is GPU-tested on vLLM 0.25.1, 0.27.1 and 0.33.0.
How the plugin plugs into LMCache
LMCache can load third-party remote backends by name (LMCache storage backends). KVStash registers as the plugin kvblockd, under vLLM's LMCache connector.
vLLM with LMCacheone process per GPU server
- vLLM LMCacheConnectorV1 vLLM's connector for LMCache
- Local LMCache CPU tier local_cpu: true keeps hot chunks in host memory
- Remote lmcache-kvblockd Remote storage plugin named kvblockd
KVStash daemon
One store for every server. Survives engine restarts.
- DRAMhot
- NVMewarm
- S3cold
- Fails open. A daemon that is down, slow or killed mid-request returns a miss, not an exception. The plugin's 10 s operation timeout sits below LMCache's blocking timeout, so a stall becomes a miss.
- No extra copy. Block bytes land directly in the pinned buffer LMCache allocates.
- Prefix-aware lookups. A batched lookup returns how many consecutive chunks are stored from the start, which is what vLLM's scheduler needs.
Configure LMCache to use KVStash
In our checks on 8 November 2026, in LMCache's own image (lmcache/vllm-openai, vLLM 0.31.0, its compiled kernels loaded), a needle prompt answered correctly on the first request and wrongly when LMCache served the same prompt from its own CPU cache, on Qwen2.5-0.5B and Qwen2.5-1.5B, with or without KVStash. If LMCache hands KVStash wrong bytes, KVStash keeps them: blocks are write-once. On vLLM 0.27 or 0.33, use the native vllm-kvblockd connector until this is fixed upstream; if you run LMCache, check a reloaded answer against a cold one first.
Use lmcache-kvblockd 0.2.1 or newer (0.1.0 never writes with LMCache 0.5.6 and newer). On a GPU, LMCache must load its compiled copy kernels: lmcache.cuda_ops on NVIDIA and AMD, lmcache.xpu_ops on Intel, lmcache_ascend.ops on Ascend. Without them LMCache copies KV with a fallback that does not handle the fused K/V layout vLLM uses since 0.26, and reloads give wrong answers. The plugin checks this at start and stays off with a log line saying why; LMCache then stops caching, and requests are still served. Check with python -c "import lmcache.cuda_ops" (on LMCache 0.5.1 to 0.5.5 the module is lmcache.c_ops). The LMCache 0.5.6 build in the official vLLM 0.33 image does not load it; there, use the native vllm-kvblockd connector.
KVStash is set with LMCache's remote_storage_plugins setting, either in an LMCache YAML file loaded with the LMCACHE_CONFIG_FILE environment variable, or inline in vLLM's transfer config with lmcache.-prefixed keys. Use one or the other, not both.
# pip install lmcache-kvblockd, into the Python environment vLLM and LMCache run in
chunk_size: 256
local_cpu: true
remote_storage_plugins: ["kvblockd"]
extra_config:
kvblockd_token: "YOUR_TOKEN"
remote_storage_plugin.kvblockd.module_path: "lmcache_kvblockd.adapter"
remote_storage_plugin.kvblockd.class_name: "KvblockdConnectorAdapter"
remote_storage_plugin.kvblockd.url: "kvblockd://STORE_HOST:9440?namespace=lmcache&streams=4" export PYTHONHASHSEED=0 # same value on every worker
vllm serve MODEL --kv-transfer-config '{
"kv_connector": "LMCacheConnectorV1", "kv_role": "kv_both",
"kv_connector_extra_config": {
"lmcache.remote_storage_plugins": "kvblockd",
"lmcache.local_cpu": true,
"lmcache.chunk_size": 256,
"lmcache.extra_config": {
"kvblockd_token": "YOUR_TOKEN",
"remote_storage_plugin.kvblockd.module_path": "lmcache_kvblockd.adapter",
"remote_storage_plugin.kvblockd.class_name": "KvblockdConnectorAdapter",
"remote_storage_plugin.kvblockd.url": "kvblockd://STORE_HOST:9440?namespace=lmcache&streams=4"
}}}' With remote_storage_plugins, LMCache 0.5.x does not read remote_url. The KVStash address goes in remote_storage_plugin.kvblockd.url. Setting remote_url as well creates a second backend that writes every block twice. Our CI test checks this against the real lmcache package.
- No
lmcache_config_filekey. Neither vLLM nor LMCache reads it; a file passed that way is silently ignored. - Same
PYTHONHASHSEEDeverywhere. Workers with different seeds compute different keys and cannot share cache. The adapter logs loudly at start if it is not pinned.
Check it is working
A misconfigured plugin fails quietly: LMCache falls back to its local tier and every remote read misses. Check each step.
- Start vLLM. The log shows
Created remote backend for plugin: kvblockd. No line means the plugin was not loaded. - Send one long prompt. The daemon's
kvb_bytes_total{dir="in"}metric rises (curl 127.0.0.1:9442/metricson the daemon host). - Still no hits? Check the token and namespace match the daemon; a mismatch turns every operation into a miss.
Versions and platforms
| Version | What we check |
|---|---|
| lmcache 0.5.1, 0.5.2 | Runtime requirement. A fresh Linux install picks the newest 0.5.x. The CPU end-to-end run uses lmcache 0.5.1 with vLLM 0.25.1. |
| lmcache 0.5.0, 0.4.7 | Interface check only: the adapter imports against them in CI, to catch renames early. |
| Platform | Linux x86_64 only. LMCache publishes no macOS wheel. |
LMCache integration FAQ
Is the LMCache plugin ready for production?
No. The plugin is built and tested in CI against the real lmcache package, but it is not qualified on GPUs: our GPU attempts so far needed a patched LMCache build. For vLLM today, use the native vllm-kvblockd connector, which is GPU-tested.
Which LMCache versions does it work with?
The package requires lmcache 0.5.1 or later and below 0.6 (a fresh Linux install picks the newest 0.5.x, 0.5.7 as of November 2026). CI also checks the adapter imports against 0.5.0 and 0.4.7. It installs on Linux x86_64 only, because LMCache publishes no macOS wheel.
Why does every request miss even though the plugin is configured?
The most common cause is putting the KVStash address in remote_url. With remote_storage_plugins, LMCache 0.5.x ignores remote_url; the address belongs in remote_storage_plugin.kvblockd.url inside extra_config. Setting remote_url as well creates a second backend and doubles every write. Also check that the token and namespace match the daemon.
Does LMCache need PYTHONHASHSEED?
Yes. LMCache's chunk hashes start from a vLLM value that depends on PYTHONHASHSEED. If workers use different seeds they compute different keys for the same tokens and cannot share cache. Set PYTHONHASHSEED=0 on every worker.
Using LMCache and want KVStash under it?
Tell us your LMCache and vLLM versions, model and GPUs. We will tell you what qualifying this path for your stack would take, and whether the native vLLM connector fits better.
Or write to rudray@kvstash.com