emin@budak: ~/blog — zsh

emin@budak ~/blog % cat valkey-9-2-shared-kv-cache.md

Valkey 9.2: The Practical Shared KV Cache Test

Valkey 9.2 shared cache across GPU workers

Valkey 9.2 matters because it changes the economics of work that usually gets blamed on GPUs. The release adds forkless snapshots, compressed replication, a B+ tree for large sorted sets, and Path Hash. The last item is unusually relevant to shared KV caching for inference, but it should not be confused with the cache itself.

That distinction is the point. A prefix index can make a distributed cache easier to route. It cannot make unrelated prompts share compute, and it cannot rescue a workload with little prefix reuse. The useful question is narrower: where does Valkey 9.2 remove infrastructure waste that is already visible in production?

Valkey 9.2 changes several expensive internal defaults

The headline feature for ordinary Valkey operators is forkless RDB work. Snapshotting and full synchronization can run on a background thread instead of creating a child process. That avoids copy-on-write overhead during write-heavy periods, though it is opt-in and costs four bytes per key. This is not a free performance switch. It is a way to stop reserving memory for a backup spike that should never have been part of steady-state capacity.

Replication gets a similar treatment. The new streaming compression is negotiated per replica, so older or opted-out replicas still receive plaintext. In the project benchmark, LZ4 cut replication bandwidth by 52 percent with less than one percent throughput overhead. The broader Linux Foundation announcement cites a 50 to 65 percent reduction in ongoing replication traffic and makes clear that the result depends on data and deployment shape.

Large sorted sets have a more structural change. Valkey replaces the skiplist representation with a B+ tree variant once a sorted set grows past the compact listpack form. The project reports 36 to 43 percent less per-member overhead for a five-million-member test using 20-byte elements. It also reports faster score updates. That is compelling for queues, rankings, and indexes that are genuinely large. It says far less about small sorted sets, which were not using the old representation in the first place.

Valkey 9.2 Path Hash routes prompt prefixes to shared cache blocks
A technical illustration of prefix routing into shared cache blocks.

Valkey 9.2 is an index for shared inference cache, not a magic cache

The most interesting new primitive is Path Hash. Its PH* commands support exact lookup, longest-prefix matching, and prefix traversal over binary-safe paths. That gives an inference stack a compact place to ask a question such as: which cached prefix is the longest match for this request?

The release sits alongside an open-source distributed KV caching capability that uses LMCache with engines such as vLLM and SGLang. The Linux Foundation describes a shared cache across GPU fleets, while Valkey acts as a lightweight index and the large KV blocks remain in GPU or host memory. That separation deserves attention. Putting every large KV block in a general-purpose datastore would produce a different bottleneck.

The published claims of up to 40 percent lower inference cost and up to 80 percent lower time to first token are not planning numbers. They are workload-dependent claims from the launch material. They make sense only when requests share a substantial, reusable prefix: a stable system prompt, repeated tool definitions, a long common document, or a common agent preamble. A consumer chat product with short, unrelated prompts should expect much less reuse.

This is the same boundary discussed in NVLink Fusion and the inference handoff: moving data is not the same as avoiding computation. Shared prefix caching earns its keep when reuse exceeds the network and lookup work required to reach the cached state.

Valkey 9.2 should be tested with a prefix reuse calculation

A quick calculation can prevent an expensive proof of concept from becoming a permanent architecture. Let R be the fraction of prompt tokens that arrive through reusable prefixes, C the cost of prefilling those tokens, and O the added cost of lookup, transfer, eviction, and misses. Shared caching helps only when R multiplied by C is comfortably larger than O.

Workload pattern Expected reuse What to measure first
Agent runs with a fixed tool catalog Often high Longest shared prefix and cache hit latency
Document Q&A with repeated source packs Potentially high Prefix churn after retrieval changes
Consumer prompts with unrelated context Usually low Miss rate and extra network time
Batch jobs with stable templates Often high Prefill tokens avoided per worker

Measure prefix overlap from request traces before installing anything. Then run a small comparison with the same model, request mix, GPU count, and context length. Record time to first token at p50 and p95, cache hit rate, network bytes, and GPU utilization. The launch figures can motivate that test. They cannot replace it.

There is a second opportunity even if shared KV caching does not fit. Forkless snapshots, compression, and more compact sorted sets are conventional operational improvements. A cluster that spends too much on replica traffic or backup headroom can benefit without changing its inference topology.

The Valkey 9.2 upgrade deserves a rollback plan

Valkey calls 9.2 a minor release and says upgrades are generally safe, but its release notes still flag behavior changes. One concrete case is tooling that expects large sorted sets to report skiplist from OBJECT ENCODING. It will now see btree. Tests and monitoring that match the old literal need updating.

Downgrades also matter. RDB files written with LZ4 or Zstandard compression need a version that understands those formats. The project recommends switching compression back to a legacy mode and running BGREWRITEAOF before a downgrade. That is ordinary release hygiene, but it is exactly the kind of detail that disappears when a performance feature becomes a rushed production change.

Valkey 9.2 is worth attention because it makes a modest claim in the right place: stop paying for work that can be reused or avoided. Start with traces, not the headline percentage. Then test the feature that matches the waste you can already see.

Read the Valkey 9.2 release announcement and the distributed KV caching announcement before planning an upgrade.