TECHNOLOGY

Dynamo KV-aware routing: balance cached context against queueing

In this article
THE QUICK TAKE

Evaluate cache-aware worker selection using prefix locality, queue delay and stale state, without confusing it with application-level model routing.

A worker that already holds a request’s context can avoid some repeated prefill. Sending every related request there can also create a queue. KV-aware routing must trade saved computation against waiting and transfer costs. It is a worker-selection mechanism inside serving infrastructure, distinct from choosing a different model or a different commercial provider for an application.

Define what the router knows

The Dynamo router overview describes selection using serving-state information. Treat that information as an estimate of a changing system. Cache blocks can be evicted, workers can restart and pending requests can grow between a decision and execution.

Document where cache and load observations originate, how old they may be and which workers advertise the same model configuration. A confident decision based on stale state can be worse than a simpler policy with fresh queue information. Cache identity and tenant boundaries must agree with the inference workers.

Keep the hashing boundary consistent

The KV-aware routing documentation describes coordination requirements between routing and serving components. Matching visible prompt text is not enough when templates, tokenization or block hashing differ across workers.

For a diagnostic trace, record which prefix the router expected to find and whether the worker actually reused it. Count prediction errors separately from ordinary misses. This reveals configuration disagreement that would otherwise look like a mysterious decline in the overall cache hit ratio.

Compare saved work with waiting

Use three cases: an idle worker with no matching blocks, a busy worker with the full prefix, and a moderately loaded worker with partial reuse. Keep the requested output budget comparable. The best destination depends on the relative cost of recomputation and queueing.

The Dynamo agentic inference discussion places cache-aware routing among several coordinated optimizations. Do not assume that cache similarity alone is the objective. A user waits for a useful answer, including the decode stream, rather than for a high cache metric.

Test changing and adversarial locality

Replay separate workloads for stable conversations, many unique documents and a sudden popular prefix. Add worker exits and controlled cache eviction. Compare against the same cluster with a simpler load-based policy under the same arrivals.

Measure first-token latency, streaming gaps, useful completions and queue distribution per worker. Inspect tail latency for the requests redirected away from popular contexts. An improvement in the dominant hot-prefix traffic can conceal starvation of unrelated work if only aggregate averages are reported.

Keep routing claims local to their scope

State the model, workload repetition, observation freshness and worker topology used in the test. Cross-node reuse can involve transfers; a wide-area location can impose costs far larger than a local prefix calculation saves. A router cannot make every distributed node equivalent.

Finally, keep application-facing provider routing separate in diagrams and documentation. An upstream platform may select Retrivium as one inference provider, while Retrivium selects a worker inside its eligible pool. These are complementary decisions at different boundaries, each with its own health and capacity contract.

Prefix caching: when repeated context helps a GPU pool, Request deadlines: budgeting queueing, prefill and streaming.

← All articles