A practical architecture for remote KV caching with Valkey

Reuse KV blocks across inference workers with Valkey Large Object, RDMA, and DRAM/NVMe tiering. Extend retention with Momento’s Object Connector.

Remote KV caching with Valkey: two GPU chips connected to a shared cache stack with a large Valkey icon across its top surface and the Momento logo in the lower-right corner.

An inference fleet can process the same context many times even when prefix caching is enabled. A worker keeps useful state locally, but the next request lands elsewhere. Long document prefixes get recomputed while their earlier results sit on another machine or have already been evicted.

Valkey gives reusable KV blocks a home outside the inference fleet. As a shared context memory layer, it lets compatible workers reuse the same blocks and gives platform teams a way to add cache capacity independently of GPU capacity. The Valkey Large Object module provides RDMA transfers and DRAM/NVMe tiering. Momento’s Object Connector can extend retention into object storage.

Consider an assistant answering questions about an operations manual. Each prompt begins with the same system instructions and manual, followed by a different question. The objective is to reuse that shared prefix wherever the next question runs.

Keep the useful state

KV cache contains the attention keys and values computed for prior tokens. Prefill processes the input and establishes this state. Decode uses it to generate the response and extends it as new tokens arrive. Keeping those tensors avoids recreating them during generation.

Prefix caching extends reuse across requests. If a later prompt has the same token prefix and compatible model state, the engine can reuse completed cached blocks. It still processes the new question and generates an answer. Matching subject matter is insufficient. Changing the instructions or moving the manual later in the prompt can change the reusable prefix.

Remote reuse also differs from prefill and decode disaggregation. Disaggregation runs the two phases on separate worker pools and requires a state handoff between them. A shared cache can support that design, but it also benefits workers that run both phases together. The manual example uses such workers.

Put Valkey between inference and storage

Deploy Valkey on storage nodes separate from the inference workers. GPU memory holds the KV blocks in active use, and worker host DRAM stages transfers. Valkey DRAM and node-local NVMe hold reusable blocks in a shared store.

Separating storage from compute lets you add cache capacity without buying another inference GPU. Replacement workers can reuse compatible prefixes while the shared Valkey tier remains available.

The following reference design stages lower tier blocks through Valkey RAM. Placement, promotion, and coordination are architectural choices for this design.

Remote KV caching architecture. Two workers, each with GPU HBM and host DRAM, coordinate lookups and transfer KV blocks between worker host DRAM and Valkey over RDMA/EFA. Valkey RAM serves hot blocks, local NVMe expands capacity, and the Object Connector extends retention.

RDMA transfers KV blocks into registered worker host DRAM. The cache manager then loads them into GPU memory. The Object Connector flushes blocks asynchronously.

The runtime integration identifies reusable blocks, coordinates availability, and arranges for tensors to become usable GPU cache state. Lookup and bulk transfer have separate roles. Finding a block does not mean that the GPU is ready to consume it.

Suppose worker A has processed the manual and exported eligible completed blocks. Worker B receives another question and checks its local cache first. On a local miss, the cache manager looks for compatible prefix blocks in Valkey. On a RAM hit, RDMA transfers the blocks into worker B’s registered host DRAM, and the cache manager loads them into the GPU KV cache. The runtime then processes the unmatched prompt suffix and continues generation.

If no useful blocks are available, worker B computes the prefix. The cache manager can admit the new blocks to shared storage for later requests.

Extend the working set with NVMe and object storage

Valkey DRAM serves frequently reused blocks. The Large Object module’s tiered mode stores blocks on Valkey-local NVMe and uses DRAM as a read cache. Tiering increased capacity per node 10-fold and reduced overall storage costs by 90%.

On a disk hit, Valkey stages the block in server memory before the RDMA transfer to worker host DRAM. The disk is local to Valkey, so inference workers share that capacity through the storage service.

A Valkey restart clears cached Large Object blocks, including those on local NVMe. For longer retention, Momento’s optional Object Connector asynchronously flushes selected blocks to object storage. If the only usable copy disappears before the flush completes, the worker may need to recompute the prefix.

In this reference design, retained blocks return through Valkey before the worker loads them into its GPU cache. Object storage extends the reuse window, with higher retrieval latency than DRAM or NVMe.

Admission and retention policies keep this hierarchy useful. Prefer blocks likely to be reused over a stream of one-time prompts. Keep copies available until transfers using them finish. Coordinate expiry across lookup metadata and lower tiers so deleted or incompatible state cannot appear as a usable hit. Evaluate the tradeoffs between capacity and coordination when defining your architecture.

Match the network to the workload

The runtime uses a control path for lookups and coordination. RDMA handles bulk movement of KV blocks between Valkey and registered worker host memory.

The zero-copy RDMA path reduced transfer duration by 80–90% relative to standard Valkey RESP.

In production, cache fills and reads can compete for bandwidth with peer-to-peer transfers between inference workers and traffic from other requests. Physical network factors such as NIC link speeds, switch capacity, and whether traffic crosses racks also affect how quickly KV blocks arrive. Even with RDMA, congestion on a shared link can slow cache reads during bursts.

On AWS, compatible worker and storage instances use Elastic Fabric Adapter (EFA) for RDMA. EFA device traffic stays within an Availability Zone and VPC.

Connect the serving stack

Momento Cache is the leading provider of Valkey, an open-source fork of Redis built for real-time workloads. With Momento Cache and Valkey, your team can enjoy the same high-performance infrastructure that powers global leaders like Snap, FOX, Coinbase, and Capcom.

The manual example uses LMCache’s Valkey RDMA integration. Valkey also integrates with vLLM, SGLang/HiCache, and KVCR.

Both workers need the same model revision and adapters, matching tokenized prefixes, and compatible tensor representation and parallel layout. Give a new model or cache format its own namespace. Scope sharing to authorized tenants or trust groups, and protect storage access independently of prefix matching. A content hash alone is not an authorization boundary. These requirements belong in the integration and deployment configuration so application code can stay focused on requests.

How to measure the impact of a shared cache

Start with two compatible inference workers and a separate RAM-backed Valkey node running the Large Object module. Confirm shared RAM reuse before adding NVMe or the optional object storage tier.

Send a long manual prefix to worker A, then send a different question with that same prefix to worker B. Keep local prefix caching enabled in your baseline. Confirm that B lacks a local copy and obtains compatible blocks from shared storage. Compare its time to first token with recomputing the prefix under the same serving conditions.

Next, grow the working set beyond the RAM tier to exercise NVMe. If you add object storage, test retrieval of blocks whose asynchronous flush has completed. Restart an inference worker to check reuse after worker turnover, and confirm that workers can recompute prefixes when shared storage is unavailable.

Measure tail latency as concurrency rises. Track block transfer time separately from end-to-end time to first token, including lookup, any lower-tier reads, and GPU loading. Record hits and retrieved bytes by tier, GPU memory pressure, and the object flush backlog where applicable. Include memory, disk, object requests, and network costs in the comparison.

Accelerate your KV caching with Valkey and Momento

Valkey gives compatible workers a shared place to reuse prefixes across requests. The Large Object module connects the shared store to worker host memory over RDMA and expands capacity with NVMe. Momento’s Object Connector extends retention when you need it. To discuss your deployment, get in touch with Momento.