dynamo-kv-router
dynamo-kv-router provides the core KV-aware routing data structures and scheduling primitives used
by Dynamo to steer requests toward workers with the best cache overlap.
What This Crate Provides
RadixTreeandConcurrentRadixTreefor prefix-overlap indexingThreadPoolIndexerandPositionalIndexerfor higher-throughput index backendsKvRouterConfig,RouterQueuePolicy, andLocalSchedulerfor request routing- Protocol and hashing helpers such as
RouterEvent,WorkerId,compute_block_hash_for_seq, andcompute_seq_hash_for_block
Basic Rust Usage
use ;
use BlockHashOptions;
let prompt_tokens = vec!;
let local_hashes = compute_block_hash_for_seq;
let seq_hashes = compute_seq_hash_for_block;
let router_config = default;
let index = new;
let scores = index.find_matches;
assert!;
assert_eq!;
assert!;
For end-to-end routing, pair the indexers with LocalScheduler and the worker/config protocol
types re-exported from the crate root.
Features
metrics: Prometheus metrics for router internalsruntime-protocols: integration points withdynamo-runtimestandalone-indexer: standalone indexer service supportbench: internal benchmarking helpers
Further Reading
- Router guide: https://docs.nvidia.com/dynamo/components/router
- Indexer internals: https://github.com/ai-dynamo/dynamo/blob/main/lib/kv-router/src/indexer/README.md
- Benchmarking the sharded KV indexer: INDEXER_BENCH.md
- Dynamo repository: https://github.com/ai-dynamo/dynamo