What traces and metrics do you need to debug a P99 TTFT regression in production LLM serving?
A team's P99 TTFT regressed from 400ms to 1.8s overnight while the model and code are unchanged. Describe the observability you'd want and how you'd use it to localize the regression to a root cause. List the specific metrics and traces involved.
Split TTFT into queue_wait plus prefill, instrument each as a per-request span, then read scheduler state for queue blowups and per-GPU counters plus prompt-length drift for prefill blowups.
Imagine a restaurant where the wait for your first bite is the number you care about. That wait has two parts: how long you stood in line before a table opened, and how long the kitchen took once you sat down. If first-bite time doubled overnight, you must know which part grew. Maybe the line got long because the dining room is full and nobody leaves. Maybe cooking got slow because one stove broke, or because everyone suddenly ordered huge meals. A serving system is the same. You stamp every order with a clock at each step, so you can see whether the line or the kitchen caused the slowdown. Without those stamps you are only guessing which half of the wait went wrong.
Detailed answer & concept explanation~8 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
5 min: decompose TTFT into queue wait plus prefill, list scheduler metrics for the queue branch and per-GPU plus prompt-length metrics for the prefill branch, then explain request-id correlation across OpenTelemetry spans and Prometheus.
Real products, models, and research that use this idea.
- vLLM exposes Prometheus metrics for KV cache usage, running and waiting request counts, and preemptions, the exact gauges you read to localize a queue-wait regression.
- NVIDIA TensorRT-LLM with the Triton backend emits per-request and per-batch latency stats plus GPU utilization counters for prefill attribution.
- OpenTelemetry GenAI semantic conventions standardize span attributes like prompt token count and model id, letting traces from Llama 4 or Claude Opus 4.7 serving join cleanly.
- Grafana dashboards backed by Prometheus and the DCGM exporter surface per-GPU HBM bandwidth and tensor-core occupancy so an outlier card stands out instantly.
- SGLang reports scheduler queue depth and cache hit rate, which distinguishes a prefix-cache miss storm from a genuine prompt-length shift.
What an interviewer would ask next. Try answering before peeking at the approach.
QHow would you distinguish a degraded GPU from a noisy-neighbor process on a shared host?
QTTFT is fine but P99 TPOT regressed. Which metrics change and why?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Treating TTFT as one opaque number. Without splitting queue wait from prefill, you cannot tell a scheduler admission problem from a slow prefill, so every fix is a guess.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.