Incident lab: TTFT jumps from 400 ms to 4 s
Median time to first token went from about 400 ms to several seconds with no errors and flat traffic. Work the incident on the simulator: split TTFT from inter-token latency, rule out demand, follow the change log, prove the prefix cache stopped hitting, fix the prompt template and confirm recovery, then write the incident record.
By Sandip Maity, Applied AI Engineer
Key takeaways
- Flat inter-token latency with rising TTFT means the extra time is queueing or prefill, not slower steps.
- Prompt length can stay the same while prefill work triples: what matters is how many prompt tokens miss the prefix cache.
- Anything that varies per request (time, request id, user name) must go at the end of the prompt, or every request misses the cache.
- Lost cache hits cost twice: more prefill compute, and a private copy of the shared prompt in every request's KV cache, so fewer requests fit.
- Alert on the prefix cache hit rate and review prompt-template changes like code that affects performance.
Goal: find out why time to first token (TTFT) rose about tenfold, prove it with evidence, fix it, confirm recovery and write the incident record.
You need: the simulator from How to work an inference incident (Python 3.10+, no GPU) and about 45 minutes. Background: prefix, semantic and KV caching.
Honest limits. The numbers come from the course's simulator, not from a real vLLM server, and the same cause can look milder or worse on real hardware. The method, and where to look on a real system, are the same.
#The page
$ python3 incident_sim.py ttft brief
PAGE 14:20. Chat API, one model replica per GPU. Median time to first token was about 400 ms
yesterday and is about 4 s now. No errors. Traffic looks normal. Find the cause, prove it, fix it.
Start with: dashboard, then changes, then whatever the evidence points to.#Step 1: scope it on the dashboard
$ python3 incident_sim.py ttft dashboard
Dashboard: TTFT went from about 400 ms to about 4 s
yesterday 14:00 today 14:00
Requests per second (in) 0.32 0.32
TTFT p50 406 ms 3.44 s
TTFT p99 1.35 s 27.57 s
Inter-token latency p50 59 ms 61 ms
Inter-token latency p99 382 ms 1.14 s
Output tokens per second 72 67
Unfinished at end of window 6 11
Errors per minute (400/429/timeout) 0.0 0.0
GPU utilisation 99% 100%
GPU memory used 43.2 / 48 GB (90%) 43.2 / 48 GB (90%)Before you read on, write down in one line each:
- What got worse, and by how much (median and p99)?
- What did not change?
- Two or three hypotheses that fit both.
The rest is Pro
Keep reading this full lab
Pro unlocks this full lab, including 2 animated diagrams, every advanced lesson, the hands-on labs and completion certificates.
One year
$25
365 days, no auto-renewal
Lifetime Best value
$75
pay once, keep it forever
7-day refund, no questions asked. One payment, no auto-renewal.Compare plansHave a licence key?
Not ready? Keep learning free
Free lessons from Incident Labs, no sign-up. Or follow the free roadmap →
Not ready? Take the free 5-day email course
One short email a day for five days, each built on a free lesson, then the occasional new lesson or offer. Unsubscribe in one click.
Still to come in this lab
- Step 2: split the latency
- Step 3: what changed?
- Step 4: the engine metrics
- Step 5: the mechanism
- Step 6: why 2.7x more prefill became 8x the TTFT
- Step 7: mitigate and confirm
- Step 8: write the record
- On a real system
- Variations
- Checklist
- Exercise
- Going deeper
You will be able to answer
- TTFT rose 8x, inter-token latency barely moved, and requests per second and prompt length are flat. Which metric is the best next check?
- Why did moving 24 tokens of metadata to the start of the prompt slow everything down?
- Besides extra prefill compute, what else did the cache misses cost?
- Which alert would have caught this incident before users noticed?