Which Replica Gets the Request (Inference Routing)
When one model runs as several replicas, every request needs a target replica. Round-robin is enough for a typical web service, but LLM requests vary hugely in length, and each replica holds a different already-computed prefix (prefix cache). So an endpoint picker (EPP) sits behind the gateway and chooses a replica by looking at replica state.
What you will learn
- Why round-robin does not fit LLMs
- The gateway picks the model; the EPP picks the replica
- Routing by prefix cache speeds up the first token
- Load must count too, or traffic piles onto one replica
On Kubernetes
In the Gateway API Inference Extension, the replicas of one model are defined as an InferencePool (inference.networking.k8s.io/v1), and the endpoint picker (EPP) attached to it chooses a replica per request. The gateway is any implementation that supports the extension. Projects such as llm-d add prefix-cache and load-based scoring on top, and for prefill/decode disaggregated serving they choose a prefill replica and a decode replica together. For what the prefix cache is, see How the KV Cache Fills Up; for split serving, see Splitting Prefill and Decode (P/D Disaggregation).
Try it yourself
kubectl get inferencepools -A # Replica set per model (InferencePool)
kubectl describe inferencepool <name> -n <namespace> # Pod selector and the attached EPP
kubectl get httproutes -n <namespace> # Gateway route pointing at the pool
curl -s http://<engine>:8000/metrics | grep -E 'vllm:(num_requests_waiting|kv_cache_usage_perc|gpu_cache_usage_perc)' # e.g. vLLM: load the picker scores (step 4)
curl -s http://<engine>:8000/metrics | grep vllm:prefix_cache # Prefix cache queries and hits per replica (step 5)
Check yourself
Further reading: Gateway API Inference Extension · llm-d · vLLM docs