Skip to content
  • vLLM
  • LLM serving
  • GPU inference
  • Kubernetes
  • Autoscaling
  • TTFT

vLLM latency, routing, and autoscaling

How long prompts stall a vLLM server, why GPU utilization is the wrong autoscaler, and which metrics to use instead. TTFT, TPOT, prefix caching, and Kubernetes routing for LLM serving.

This is part 2 of a practical guide to running vLLM on Kubernetes. Part 1 covers memory, the KV cache, and startup failures. Part 3 covers model behavior, multi-GPU pods, and tool calling over MCP. Related work sits on the projects page.

The internal proof of concept behind these notes served Qwen3-32B with vLLM on NVIDIA T4 and A100 GPUs in GKE. The latency cases here are what to watch for once the process stays up. They are common cases, not a record of that POC.

Memory failures are loud. Latency failures are quiet. The pod is ready, GPU utilization looks “healthy” because it is pinned high, and users are still waiting. The useful signals are queue depth, KV cache usage, time to first token, and time per output token.

Two clocks, not one latency number

Time to first token (TTFT) is how long the user waits before anything appears. It is dominated by prefill, which reads the prompt, and by queueing, which is other work in front of this request. Time per output token (TPOT) is the gap between later tokens. It is dominated by decode, and by how much other work shares the batch.

A change that helps one clock often hurts the other. A larger --max-num-batched-tokens finishes a long prefill sooner, so that request’s TTFT drops, and everyone else waits longer between tokens. A smaller value does the reverse. Chunked prefill is the switch that lets you make that trade at all. With it off, a long prefill is one uninterrupted chunk.

vLLM records both clocks. vllm:time_to_first_token_seconds and vllm:request_time_per_output_token_seconds are histograms. Read a high quantile, not the average. A mean TTFT can look fine while the slow tail, the requests with large tool results, is the thing users complain about. vllm:inter_token_latency_seconds is the gap between streamed tokens if you want the same view from the stream rather than from the finished request.

When you change a flag, write down which clock you are trying to move. “Latency improved” without saying which one is how a benchmark and a user disagree. Part 3’s rule is the same idea at the proof-of-concept boundary. The number you publish has to be the clock you promised.

One long prompt freezes everyone else

Symptom. Most streams are smooth. Then one request starts, and every other user’s tokens stop until it moves on. A batch job against the same URL does the same thing to live traffic.

Cause. Prefill reads the whole prompt before decode produces tokens. A huge tool result is a long prefill. While that prefill runs as one chunk, other sequences in the batch do not get decode steps, so their streams freeze. Interactive users and a batch evaluation job on one endpoint share that fate.

Fix. Turn on chunked prefill and set --max-num-batched-tokens so a long prefill is split into chunks. Smaller values leave more room for other requests to decode between chunks, which helps inter-token latency. Larger values finish the long prefill sooner, which helps time to first token for that one request. The optimization notes describe that tradeoff. If chunked prefill is off, --max-num-batched-tokens has to be greater than --max-model-len or the server can fail at startup. Split the traffic too. Interactive questions and batch evaluation do not belong on the same pool.

vllm serve Qwen/Qwen3-32B \
  --enable-chunked-prefill \
  --max-num-batched-tokens 2048 \
  --max-model-len 16384

2048 is a starting point for protecting other streams, not a measured optimum. Change it against your own p95, not against a default.

Prefix cache misses

Symptom. The second turn of a conversation is as expensive as the first. A long system prompt and a long tool list are reprocessed every time. Adding replicas does not help as much as the replica count suggests.

Cause. Prefix caching skips prefill for a token prefix the replica has already seen. It misses when the prefix is not stable, and it misses when the next request lands on a different replica. A timestamp or the user’s name at the front of the prompt makes the rest of the prompt unique, so the tool definitions behind it never cache. Round-robin does the other half. Each turn builds a cache on one pod and then the balancer sends the next turn somewhere else.

Fix. Put the static text first. Instructions and tool definitions stay at the front. The timestamp, the user, and the new question go at the end. Then route so that a conversation prefers the replica that already holds that prefix. Cache-aware routing, for example GKE Inference Gateway, exists for this. A sticky key derived from the conversation id is the simple version. Enable prefix caching with --enable-prefix-caching only after the prompt layout is stable. Caching a unique prefix on every request wastes the lookup.

Balancers that ignore the GPU

Symptom. One replica has a deep queue, on the order of tens of requests, while another is nearly idle. Or a few very long requests share one replica and that replica’s p95 jumps.

Cause. A load balancer that counts connections, or that round-robins TCP sessions, cannot see the GPU. Two connections can be a short question and a prompt with a large tool result. They are not equal. The replica with the long work falls behind, and more connections keep landing on it because the balancer does not read queue depth.

Fix. Route on vLLM’s own view of load. vllm:num_requests_waiting is how many requests are queued. KV cache usage (vllm:kv_cache_usage_perc on current builds) is how full the device is. A balancer or gateway that reads those will stop pouring work onto the replica that is already behind. Connection count is the wrong weight.

Autoscaling on GPU utilization

Symptom. The bill stays high overnight. During a spike, users still wait a long time even though the scaler is “working.”

Cause. Two separate mistakes. GPU utilization sits near 100% whenever the batch is active, including light load, because of continuous batching. A target on that metric never decides the pool is idle, so it does not scale down. When a spike does add a replica, the new pod still has to pull the image and load weights. Part 1’s cold start, on the order of 10 minutes for a large checkpoint, means the replica is ready after the spike.

Fix. Scale on queue depth and cache pressure. KEDA’s Prometheus trigger can query the same series you alert on.

triggers:
  - type: prometheus
    metadata:
      serverAddress: http://prometheus.monitoring.svc:9090
      query: max(vllm:num_requests_waiting)
      threshold: "1"

A threshold of 1 means “scale when any request is waiting.” That is an example policy, not a number from a benchmark. Pair it with a second trigger on vllm:kv_cache_usage_perc if the cache fills before the queue does. Keep a minimum replica count for the peaks you already know, and scale ahead of them. Measure cold start as the time from pod scheduled to the first served request. If that number is minutes, no scaler reacts inside a short spike.

How to confirm the old metric was wrong: plot replica count against vllm:num_requests_waiting for a day. Replicas that stay up overnight while the waiting gauge is zero are the utilization target refusing to scale down.

vLLM exposes these series on /metrics. It does not emit them as OpenTelemetry metrics. It can export per-request traces to a collector. A normal setup is a collector that scrapes /metrics for the fleet view and receives traces when you need one slow request. Prometheus for the pool, traces for the single request.

Benchmarks that do not look like traffic

Symptom. A benchmark reports a high request rate and a low latency. The same server feels much slower once real clients show up.

Cause. The benchmark was a different workload. Short random prompts skip tool definitions and tool results. Real prompts in a tool-calling assistant are often several times longer. Three times longer is a common gap, and prefill cost follows that length. Repeating one prompt also flatters the run, because prefix caching makes the second copy cheap. Peak throughput, the most requests per second you can push, is usually the point where latency is already bad.

Fix. Replay realistic traffic. Include the tool definitions and a sample of tool results. Measure p95 time to first token and p95 time per output token, and run it more than once so a warm cache is not the whole story. The number to keep is how many requests you can serve while p95 stays inside the latency you promised. Part 3 comes back to this as the difference between a proof of concept benchmark and a latency target. k6 is a fine runner for the shape of the test. A run that looks fine at 8 concurrent users can fall over at 64 when the prompts are the long ones. Treat that as a test design check, not as a universal breakpoint.

Reasoning mode and latency

Symptom. A short question, the kind that should be a single tool call, takes on the order of 10 seconds. The answer contains thinking text the user should not see. Token spend and GPU count both look too small a week later.

Cause. Some Qwen3 checkpoints enable a thinking mode by default. The model generates a reasoning trace before the answer. That trace is extra output tokens, so time to first visible token and time per request both grow. The trace can also leak into the text the client shows. The GPU budget you sized without those tokens no longer matches the traffic.

Fix. Turn thinking off for simple tool routing, where the model only has to pick a tool and the semantic layer does the math. Keep it for questions that actually need the extra steps. Set --reasoning-parser to the parser for that model family so thinking tokens are separated from the answer instead of landing in the message. Re-check token counts after you change the default. A mode that adds a hidden chain of thought is a capacity change, not just a quality change.

Timeouts and requests that keep running

Symptom. Long answers stop halfway through. Or a user closes the tab and the GPU keeps generating the rest.

Cause. Streaming responses outlive the timeouts people set for ordinary HTTP. A Google Cloud load balancer or an ingress with a short backend timeout cuts the stream. Separately, if a client disconnect does not abort the vLLM request, the decode loop runs to the end and spends KV cache on text nobody will read.

Fix. Raise the backend and ingress timeouts to cover the longest answer you intend to stream. Confirm that a client disconnect aborts the request inside vLLM, so the sequence is freed. A stream that continues after the tab is gone is capacity you cannot bill to a user and cannot use for the next one.

What to put on the dashboard

Four series cover the failures in this post. Anything else is optional until one of these is flat and users are still unhappy.

vllm:num_requests_waiting is the queue. It should sit at zero most of the time and rise when you are actually out of capacity. vllm:num_requests_running is the batch. A high running count with a zero waiting count is a busy server that is keeping up. A rising waiting count is the one to page on.

vllm:kv_cache_usage_perc is the cache. Treat a sustained value near 1 as full, and page before that, not after the restarts in part 1. Older releases called this vllm:gpu_cache_usage_perc. Query /metrics once on the image you deployed and pin the name in the dashboard so a vLLM upgrade does not silently blank the chart.

vllm:time_to_first_token_seconds and vllm:request_time_per_output_token_seconds are the clocks users feel. Alert on a high quantile over a few minutes, not on a single slow request. A p95 that moves when you change --max-num-batched-tokens is the chart that tells you which way the tradeoff went.

If the waiting gauge and the cache gauge disagree, believe both. A full cache with an empty queue is preemption waiting to happen. An empty cache with a long queue is a scheduler that cannot start work, often because max-num-seqs or the prefill budget is the limit. Those are different fixes. More replicas do not repair a prompt that is longer than max-model-len.

Part 3 is what the model emits once the server is fast enough to matter. Tool-call parsers, chat templates, and a tensor-parallel hang that only shows up inside a pod are the usual next failures. Part 3.

FAQ

How do I autoscale vLLM on Kubernetes?
Scale on vLLM metrics, not GPU utilization. vllm:num_requests_waiting is the queue depth, and vllm:kv_cache_usage_perc is how full the cache is. KEDA or the Prometheus adapter can read both. GPU utilization stays near 100% even at light load because of continuous batching, so a utilization target neither scales down nor tells you that users are waiting. Keep a warm minimum number of replicas, because a cold start that downloads and loads weights can take about 10 minutes.
Why does GPU utilization stay near 100% for vLLM at light load?
Continuous batching keeps the GPU busy whenever any request is in flight, including a single short one. The device looks saturated in the NVIDIA metric long before the queue or the KV cache is actually full. That is why a utilization-based autoscaler stops scaling down and the bill stays high overnight. Compare replica count with vllm:num_requests_waiting over a full day. Replicas that stay up while the queue is zero are the proof.
What is TTFT and TPOT in vLLM?
TTFT is time to first token, how long the user waits before the stream starts. TPOT is time per output token, how fast tokens arrive after that. vLLM exposes them as vllm:time_to_first_token_seconds and vllm:request_time_per_output_token_seconds. A capacity number that ignores both can look fine while the stream feels slow. Read p95 of each on realistic prompts, not the mean of a short-prompt benchmark.
Why do long prompts freeze every other vLLM request?
Prefill of a long prompt occupies the batch. Other streams wait until that prefill makes progress. A single huge tool result, or a batch evaluation job pointed at the same endpoint, is enough. Chunked prefill (--enable-chunked-prefill with a tuned --max-num-batched-tokens) lets decode tokens from other requests run between chunks of the long prefill. Put batch jobs on a separate pool so they cannot stall interactive traffic.
Why does a vLLM benchmark look faster than real traffic?
Short random prompts skip the tool definitions, tool results, and chat history that real requests carry. Those extras can make a prompt several times longer, and prefill cost follows length. Repeating the same prompt also hits the prefix cache, so the second run is cheaper than a user who never sends that prefix. Replay a sample of real requests, measure p95 TTFT and TPOT, and report more than one run.
Portrait of Rohith Reddy Kota

Written by Rohith Reddy Kota

Forward Deployed Engineer at Rill Data. I run 2+ PB of ClickHouse, Druid, and DuckDB on Kubernetes for enterprise analytics customers.

Connect
esc
↑ ↓ navigate↵ select