Summary
This demo shows how the router treats two kinds of requests differently:- Requests that match existing saved state (“returning” requests) are routed to the pod that already holds that state — the router “pulls them home”.
- Brand-new, unique requests (no saved state anywhere) are spread across available pods based on live signals such as CPU availability, request queue lengths, scratchpad usage, and the newcomer spreader.
Router behavior and expectations
The router configuration encodes both behaviors:- If a prompt has saved work, the router should favor routing it back to the pod that already has that work (high “prefix” score).
- If a prompt has no saved work, the router should place it where it will cost the least at runtime — i.e., wherever capacity is available, which should naturally distribute new work across the fleet.
Observing the baseline in Prometheus
Before sending traffic, we query Prometheus for prompt tokens processed by each pod:Burst test — 30 unique concurrent requests
This test launches 30 distinct prompts in parallel. Each prompt includes a unique counter so the router cannot treat them as saved-state matches; every request is a newcomer. Shell prompt before firing the requests:&), responses stream back as each pod finishes its work. The output below is a scrambled sequence because processing happens concurrently across pods:
Compare with a concentrated run (repeated identical prompt)
For contrast, here is the same Prometheus query used for the concentrated run:Quick comparison
Note: In the table, Prometheus-style labels are shown as code snippets.
Why this matters
- The router applies one consistent cost-based rule to every request: route to the pod that will minimize cost.
- If saved work exists, the cheapest choice is where the saved state lives (concentrate).
- If no saved work exists anywhere, the cheapest choice is wherever capacity is available (spread).
- This is fundamentally different from a blind load balancer, which treats all connections equally and cannot preserve or exploit saved work affinity.
- The observed behavior relies on the router’s heuristics and visibility into traffic patterns; it is effective but still an inference.
One honest caveat: these routing decisions still relied on the router’s visibility into where saved work likely lives, inferred from observed traffic. That’s a good heuristic but still a guess. The next step is routing that knows exactly which pod holds which saved work and a cache or metadata store the router can consult to make definitive routing decisions.
Key takeaways
- The same routing logic can produce both concentrated and spread outcomes depending only on whether requests match saved work.
- Prometheus metrics provide an effective way to confirm where prompt tokens are processed and to validate routing behavior.
- To make routing decisions deterministic for saved work, introduce an authoritative metadata store or cache the saved-work-to-pod mapping in the router.
Links and references
- Prometheus — https://prometheus.io/
- Kubernetes concepts — https://kubernetes.io/docs/concepts/overview/what-is-kubernetes/
- For further reading on load balancing vs. stateful routing, consult deployment-specific docs or the router’s configuration guide.