Lesson 14 of 14
Measuring a serving system
Before signing a speed promise, you must measure three things: how soon the first word appears, how fast the rest follow, and how many requests per second you can take while keeping both. The numbers depend on how you test. A polite test can make a struggling server look fine. This lesson shows how to measure honestly and turn the result into one number you can sign.
A live server, one bar per request
01 · Three questions
What the customer is asking
A reply streams out in tokens (a token is a piece of a word, about three-quarters of one on average). The first question is how long until the first one appears: the time to first token, or TTFT. It covers the wait in line and the time the server spends reading the prompt.
The second is how fast the rest follow: the time per output token, or TPOT, the average gap after the first. The third is how many requests per second the server can take while keeping both. That one is goodput.
One request, timed
waiting in linereading the prompt (prefill)writing the reply, one tick per token
02 · The unlucky few
Averages hide the line
Users do not arrive evenly. Now and then several arrive together, every seat in the batch is taken, and a line forms. Most requests never see it. The few caught in it wait far longer.
At 70 requests a second, the median request gets its first token in 23.3 ms, but the mean is 112 ms, dragged up by the unlucky. So a promise counts requests, not the average: the p99, the time 99 requests in 100 beat, or a share, such as 9 in 10.
Wait for the first token, every request in one test
- Requests arriving
- Median
- Mean
- p99
03 · The polite test
A test that waits hides the line
The easy load test is a fixed crew of test clients, each sending its next request the moment its reply ends. On lesson 6’s sushi counter, a crew that is still eating cannot arrive in a burst, so no line forms at the door.
The test slows down exactly when the server struggles. Engineers call this coordinated omission. On the simulated server, 256 test clients see a p99 TTFT of 32.0 ms. Users arriving at random, at about the same throughput, see 703 ms. Test with random arrivals.
The sushi counter: customers or a test crew
- Waiting at the door
- First piece (first token)
- Later pieces
- Still to come
Wait for the first piece, one dot per diner served
- Got the whole promise
- Promise broken
04 · The number to sign
Sweep the load, then sign
So send random arrivals at rising rates and, at each, count the requests that got both halves of the promise. Goodput is the highest rate at which at least 9 in 10 did: 50 requests a second here, with first tokens within 100 ms and 8.0 ms per token. At that rate, 99 requests in 100 see a first token within 29.3 ms.
The pace breaks first, not the line. Each extra request in the batch makes every round a little longer, so TPOT creeps up for everyone at once while throughput, the work finished per second, still looks healthy.
Llama 3.1 8B on one H100, simulated: which half breaks first?
8,000 requests per test. Plays by itself; touch a control to take over.
First token, slowest 1 in 100 (p99 TTFT; shorter is better)
Log scale: each equal step to the right is ten times longer.
Time per token after it, slowest 1 in 100 (p99 TPOT; shorter is better)
Requests that got the whole promise (longer is better)
Requests finished per second
05 · Playground
Find your own goodput
Set a promise with the two limit sliders, then move the load until the shaded band ends. Switch to the test crew and see how far right the curve gets before first tokens slow down.
Run the load test yourself
Llama 3.1 8B on one H100, simulated in your browser
The simulation runs when this figure scrolls into view.
- Throughput
- TTFT p50 / p99
- TPOT p50 / p99
- Meet both SLOs
- Request goodput (this run)
- Little's law
06 · Glossary
The vocabulary, in one place
- Token
- The unit a model reads and writes: a piece of a word, about three-quarters of one on average. A reply streams out one token at a time.
- Time to first token (TTFT)
- From sending a request to receiving the first token of the reply. It includes the wait in line and the time spent reading the prompt.
- Time per output token (TPOT)
- The average gap between tokens after the first one. It sets how fast the reply streams.
- Prefill
- Reading the prompt: one pass of the model over all its tokens, which ends with the first token of the reply.
- Batch
- The requests a server works on together. Each round of the batch adds one token to every request in it; the simulated server holds up to 256.
- Throughput
- Work finished per second: tokens per second, or requests per second. It counts every request, kept promise or not.
- Promise (SLO)
- A limit on latency a request must meet. Here, first token within 100 ms, then 8.0 ms or less per token on average. Engineers call it a service-level objective.
- Goodput
- The highest load at which at least 9 requests in 10 keep the promise: 50 requests per second for this server.
- Mean, median, p99
- The mean is the average. The median is the middle value: half the requests are faster. The p99 is the time that 99 requests in 100 beat.
- Open loop
- A load test that sends requests at random times, whatever the server is doing, the way independent users do.
- Closed loop
- A load test with a fixed crew of clients, each sending its next request only when its reply ends.
- Coordinated omission
- What a closed-loop test does: it slows down exactly when the server struggles, so it leaves out the slow moments.
You can now
- Explain what TTFT, TPOT and goodput measure, and why a latency promise counts the share of requests that meet it (or a tail percentile such as p99) rather than the mean.
- Explain why a closed-loop load test (a fixed crew of clients that wait for replies) hides the queueing that random, open-loop traffic exposes, and decide which load mode a benchmark should use.
- Compute goodput from a load sweep as the highest arrival rate at which at least 90% of requests meet both the TTFT and TPOT limits, and say whether the token pace or the queue binds first.
Try it in the Serving Lab: Run a load sweep and find the goodput you can honestly promise.
Open the workbook: the formulas, the exact numbers, graded exercises and the sources behind this page.