When Cache Reads Are Slower Than Recomputation: The Underestimated Read Cost in LLM Inference

    This article examines a counterintuitive production case from a large-scale Mixture-of-Experts (MoE) inference service: after introducing a shared KV cache to accelerate long-context requests, median latency barely improved while p99 latency surged from ~3.9s to 17.3s. We analyze why a shared L2 cache became a serialization bottleneck under strongly synchronous context parallelism, covering bandwidth contention, synchronous write amplification, and low hit rates. We then present practical remediation strategies—asynchronous writes, tiered locality, a quantitative cost model for cache decisions, and fine-grained eviction—and distill key lessons: cache benefits must always be evaluated net of read costs, especially in high-concurrency, tightly coupled inference systems.

    1. The Symptom: Tail Latency Exploded After the Cache Went Live

    During an optimization effort for the inference service of an extremely large Mixture-of-Experts (MoE) model, the team ran into a counterintuitive phenomenon. To speed up long-context requests, they introduced a shared cache layer for previously computed attention intermediate results (KV data). The design intent was straightforward: when a subsequent request shares a prefix or context with a historical request, reading from the cache directly would eliminate redundant computation.

    Post-launch monitoring told a very different story. Median request latency barely improved, but the slowest 1% of requests—p99 latency—jumped from roughly 3.96 seconds to 17.3 seconds, a more than 4x regression. The team was forced to roll back the entire cache feature. This case reveals an easily overlooked truth: reading from a cache has a cost of its own, and in high-concurrency, large-scale inference scenarios, that cost can be far greater than expected.

    2. Understanding the Bottleneck: The Underlying Architecture

    To locate the problem, one must first understand the system’s architectural characteristics.

    The attention mechanism. The model uses a Multi-head Latent Attention (MLA)-style technique that compresses each token’s key-value information into a low-rank vector. As a result, regardless of the number of attention heads, the intermediate data stored per token is fixed and small. At FP8 precision, every 256 tokens are packed into one block of about 12.4 MB—roughly 48 KB per token on average. This compression greatly reduces storage pressure, but it does not eliminate the cost of data movement itself.

    The parallelism strategy. Prefill computation for long contexts is extremely compute-intensive, so the system adopts context parallelism (PCP): the long sequence is split into multiple shards processed simultaneously by multiple GPUs within a node, which synchronize results over the network so that every GPU holds the full context. This means the 8 ranks in a node mesh like gears—strongly synchronized and tightly coupled. If any single GPU slows down, the other seven must wait. This property guarantees that any additional latency introduced anywhere is amplified across the entire node.

    3. Why the Cache Made Things Slower: Two Tiers, One Bottleneck

    Cache systems are typically designed in two tiers: L1 sits close to the GPU in local memory—fast but limited in capacity; L2 is deployed in a separate key-value store service with large capacity, shareable across multiple inference engine instances—essentially a “public library.” The problem lay squarely in L2.

    Think of it as the bookkeeping model of a chain of bubble-tea shops: each branch keeps its own ledger (L1), but all transactions must also be written into a single master ledger (L2) maintained by one accountant. At peak hours, eight branches write simultaneously and all queue up at the accountant’s desk. Translated into technical terms, there are three typical problems:

    1. Hot spots and bandwidth contention. All inference instances share the same L2 endpoint. When multiple nodes concurrently read and write large KV blocks (each in the tens of MB), network bandwidth and the storage service’s throughput become the bottleneck, and queueing delay is added directly onto the request path.

    2. Write amplification blocking the critical path. If cache writes are synchronous, they consume the communication and I/O windows of the prefill stage. Under a strongly synchronized parallel architecture, one slow write makes every rank in the node wait together.

    3. Hit rates below expectations. In long-context scenarios, even when requests share a prefix, subsequent content may diverge significantly. If the cache granularity is poorly designed, a large volume of data is “written but never read,” consuming bandwidth with almost no benefit.

    4. The Fix: Turning the Cache from a Liability into a Real Speedup

    For the problems above, mature optimization directions in the industry include:

    1. Asynchronization and bypassing. Remove cache writes from the request critical path by writing asynchronously in the background: read only on a hit, never block on a miss. Reads should also have strict timeouts and a degradation policy—if the L2 response is slower than a threshold, fall back directly to local computation.

    2. Tiering and localization. Expand L1 capacity and improve the local hit rate to reduce dependence on the shared L2. On the L2 side, add read-write separation and concurrency handling to avoid the “single accountant” hot spot.

    3. Quantify the benefit before deciding. Introduce an explicit cost model for the cache: read latency × frequency versus recomputation latency × hit rate, and enable the cache only when the expected benefit is positive. Illustrative decision logic:

    1. def should_use_cache(hit_rate, t_read, t_compute):
    2. # Expected read cost must be significantly lower than expected recompute cost
    3. return hit_rate * t_read < 0.5 * t_compute
    1. Fine-grained management and eviction. Cache and evict at block granularity, weighted by access frequency (e.g., an LFU variant), to prevent cold data from consuming bandwidth and capacity.

    After these kinds of changes, the system’s cache feature finally delivered positive returns: p99 latency fell back to—or even below—the baseline without caching, and throughput in long-context scenarios improved noticeably.

    5. Takeaways

    The core lesson of this case is one sentence: a cache’s benefit must be evaluated after subtracting its read cost. In strongly synchronized, highly concurrent inference systems with large per-block data sizes, “reading the cache is slower than recomputing” is no fantasy. Three principles are worth remembering: first, any shared component can become a serialization bottleneck and its concurrency capacity must be assessed; second, cache decisions should be driven by a quantitative cost model rather than intuition; third, every external dependency on the critical path needs a timeout and fallback. A cache is never a free lunch—only when all of its hidden costs are accounted for does it truly become an accelerator.