L1 eviction races async L2 store: chunks discarded before offload are never stored (persistent re-prefill under L1 pressure)
Label Bug
Describe the bug In LMCache v0.5.5 (MP mode), under L1 (CPU) memory pressure, freshly-computed KV chunks can be evicted from L1 before the asynchronous store controller offloads them to L2, so they are silently dropped and never written to L2 — even when L2 is large enough to hold the entire working set and has no eviction configured.
The result: with a shared-prefix (prefix-caching-style) workload, ~19% of requests permanently retrieve only the shared prefix (first half of the prompt) and re-prefill the unique tail on every recurrence, indefinitely. The half-hits persist through the whole run, not just warmup.
Root cause (confirmed in v0.5.5 source):
L1 eviction destination defaults to EvictionDestination.DISCARD — L1 eviction does not offload to L2 (lru.py, eviction_controller.py:193). The StoreController offloads L1→L2 by reserve_read-ing keys received from an L1_WRITE_FINISHED notification. If a key was already discard-evicted in the meantime, reserve_read returns KEY_NOT_EXIST, the key is silently skipped from the store (only surfaced as an L1_READ_FAILED / lmcache_mp.l1_read_failure "not_found" anomaly), and it never reaches L2 (lmcache/v1/distributed/storage_controllers/store_controller.py:600-627). So there is a race between L1 DISCARD eviction and the async L2 offload; the loser is silently never stored.
To Reproduce Environment: LMCache v0.5.5, MP mode, L1 + L2 where L2 is sized to hold the full working set and has no L2 eviction, and L1 is smaller than the shared-prefix working set.
Start the LMCache MP server with a small L1 and one large L2 adapter (e.g. S3/filesystem), no L2 eviction:
lmcache server --host 0.0.0.0 --port 6555 --chunk-size 256
--l1-size-gb 60 --eviction-policy LRU
--l2-adapter '{"type":"s3", ... ,"max_capacity_gb":500}'
Start vLLM with LMCacheMPConnector (kv_role: kv_both), --no-enable-prefix-caching --enforce-eager.
Run a shared-prefix benchmark whose prefix pool exceeds L1. With aiperf/genai-perf
--prefix-prompt-length 4096 --num-prefix-prompts 150
--isl 4096 --osl 100 --num-dataset-entries 200
--concurrency 10 --random-seed 42 --benchmark-duration 1200
Here 150 prefixes × 4096 tokens ≈ 75 GB of prefix KV > 60 GB L1. Each request = 8192 tokens (4096 shared prefix + 4096 unique tail).
Grep the server log for Retrieved N tokens.
Observed — persistent prefix-only half-hits throughout the run (not just warmup) Half-hits occur at ~20–32/min even in steady state, long after every one of the 200 fixed prompts has been served many times. Since retrieval is a contiguous match from token 0, Retrieved 4096 means "prefix found, tail missing → prefill." (Optionally, lmcache_mp.l1_read_failure / L1_READ_FAILED "not_found" events fire in the same window.)
Control: setting --num-prefix-prompts 10 (prefix pool now fits in L1) eliminates the half-hits — all requests become full 8192-token hits. So the trigger is specifically L1 < shared-prefix pool.
Expected behavior Once a chunk is computed and admitted to L1, it should reliably be offloaded to L2 and remain retrievable regardless of L1 pressure. A chunk should not be silently dropped from the L2 store just because it was evicted from L1 before the async offload read it. Subsequent requests for the same prompt should be full L2 hits, not re-prefills, when L2 has capacity and no eviction.
Screenshots N/A (server-side KV-cache behavior; log evidence included above).
Desktop (please complete the following information): OS: Linux LMCache: v0.5.5 vLLM: 0.26.0 PyTorch: 2.11.0+cu130 Python: 3.12.3 GPU: NVIDIA L40S Mode: MP (LMCacheMPConnector, kv_role: kv_both), --chunk-size 256, --l1-size-gb 60, L2 sized to hold full working set with no L2 eviction
Smartphone (please complete the following information): N/A (not a mobile/browser issue)
Additional context Add any other context about the problem here.
Source: LMCache/LMCache