Dynamo KV Smart Router A/B Benchmarking Guide
Dynamo KV Smart Router A/B Benchmarking Guide
Dynamo KV Smart Router A/B Benchmarking Guide
This guide walks you through setting up and running A/B benchmarks to compare Dynamo’s KV Smart Router against standard round-robin routing on a Kubernetes cluster.
Dynamo’s KV Smart Router intelligently routes requests based on KV cache affinity, improving performance for workloads with shared prompt prefixes. This guide helps you:
Prerequisites: Kubernetes cluster with GPUs, kubectl, helm
kubectl (configured with cluster access)helm (v3+)This guide sets up two parallel deployments, as well as a benchmarking pod that can test each deployment:
Key Difference: Deployment B sets DYN_ROUTER_MODE=kv on the frontend to enable KV cache-aware routing.
If the model you’re seeking to deploy requires HF token to download (Llama family models require this), replace YOUR_HF_TOKEN with your actual HuggingFace token:
If your cluster uses namespace-restricted Dynamo operators, you’ll need to install the Dynamo platform in each namespace. Follow the Dynamo Kubernetes Installation Guide to install the platform in both namespaces:
router-off-testrouter-on-testKey Configuration Notes:
dynamo-operator.namespaceRestriction.enabled=true is set during installationWait for operators and infrastructure to be ready:
You should see:
dynamo-platform-dynamo-operator-controller-manager (2/2 Running)dynamo-platform-etcd-0 (1/1 Running)dynamo-platform-nats-0 (2/2 Running)Create router-off-deployment.yaml:
Create router-on-deployment.yaml:
💡 Optimization Tip: Each worker will download the model independently (~20 minutes per pod). For faster initialization, add a shared PVC with ReadWriteMany access mode to cache the model.
First, create the PVC separately:
Then reference it in your DynamoGraphDeployment:
With this configuration, only the first worker downloads the model; others use the cached version, reducing startup time from 20+ minutes to ~2 minutes per pod.
Wait for all pods to reach Running status and pass readiness probes.
Expected Timeline:
The startup probe allows 32 minutes per pod (failureThreshold: 60), which accommodates model download and initialization.
⚠️ CRITICAL CHECKPOINT: Before running benchmarks, you MUST verify equal worker health in both deployments. Unequal worker counts will invalidate your comparison results.
Both must show 8/8 workers in Ready state (1/1 Running). If workers are not ready:
kubectl logs -n <namespace> <pod-name>Do not proceed with benchmarks until all 16 workers (8 per deployment) are healthy.
For this A/B comparison, we use the Mooncake Trace Dataset, published by Mooncake AI. This is a privacy-preserving dataset of real-world LLM inference traffic from production arxiv workloads.
What’s in the dataset? Each trace entry contains:
Sample trace entry:
The Challenge: Traditional LLM benchmarks use synthetic or random data, which are often insufficient to capture real-world optimizations like KV Smart Router. To properly evaluate this feature, we need realistic traffic patterns with prefix repetition - but this creates a privacy problem: how do we measure realistic KV cache hit patterns without exposing actual user conversations?
Mooncake’s Solution: Privacy-Preserving Block Hashes
Instead of storing actual prompt text, the Mooncake dataset uses cryptographic hashes to represent KV cache blocks. Each hash ID represents a 512-token block, and the hash includes both the current block and all preceding blocks. This preserves the pattern of prefix reuse while completely protecting user privacy.
When requests share the same hash IDs (e.g., blocks 46-61), it means they share those 512-token blocks - indicating significant prefix overlap (in this case, 8,192 tokens). The KV Smart Router routes requests with matching hash IDs to the same worker, maximizing cache hits and avoiding redundant computation for those shared prefix tokens.
Key Dataset Properties:
Why this matters: With random synthetic data, the KV Smart Router would show no benefit because there’s no prefix reuse to exploit. Mooncake traces provide realistic workload patterns that demonstrate the router’s real-world performance gains while respecting user privacy.
Create benchmark-job.yaml:
Deploy:
Wait for pod to be ready:
This will take 3-5 minutes. The terminal output includes a summary table.
Your Results May Vary: The improvement from KV Smart Router depends heavily on your workload characteristics:
Factors that increase KV router benefit:
Factors that reduce KV router benefit:
Expected Performance:
KV Smart Router is beneficial when:
Standard routing is better when:
From the terminal output, compare the summary tables:
In this example with all 8 workers healthy, the KV router significantly outperformed the baseline:
The Mooncake arxiv dataset has sufficient prefix overlap (long input sequences with similar patterns) to benefit from KV cache-aware routing. Workloads with explicit shared prefixes (system prompts, templates) may see even greater improvements.
Cause: Insufficient GPU resources
Solution:
Cause: Version mismatch or missing credentials
Solution:
Cause: Namespace restrictions
Solution:
--restrictedNamespace=<your-namespace> argumentkubectl logs -n <namespace> deployment/dynamo-platform-dynamo-operator-controller-managerCause: Model download failures or probe configuration
Solution:
Cause: Startup probe timeout - workers killed before finishing initialization
Symptoms:
Solution:
Increase the startup probe failureThreshold:
Or update your YAML before deploying:
Model Loading Times (approximate):
Cause: Resource constraints, image pull issues, or configuration errors
Solution:
Replace Qwen/Qwen3-32B with your model in:
args section--model and --tokenizer parametersChange replicas: 8 in the deployment YAMLs. Ensure both deployments use the same count for fair comparison.
Replace mooncake dataset with your own JSONL file:
timestamp field--custom-dataset-typeFor advanced testing, add separate prefill workers:
This guide provides a complete methodology for A/B testing Dynamo’s KV Smart Router. The KV router’s effectiveness depends heavily on workload characteristics—datasets with high prefix overlap will show the most benefit.
For questions or issues, consult the Dynamo documentation or open an issue on GitHub.
router-off-deployment.yaml: Standard routing deploymentrouter-on-deployment.yaml: KV router enabled deploymentbenchmark-job.yaml: AIPerf benchmark podprepare-dataset.sh: Dataset preparation scriptRepository: https://github.com/ai-dynamo/dynamo