Measure goodput against TTFT and TPOT SLOs
Why it matters Capacity planning for LLM APIs is done against goodput at a latency target, because raw throughput can rise while users get a worse experience.
Throughput counts every request, even slow ones. Goodput only counts requests that met the latency targets, which is what users actually feel.
Write slo_goodput(ttft, tpot, out_tokens, ttft_slo, tpot_slo, window_s). ttft and tpot are lists of seconds per request; out_tokens is the number of output tokens. A request meets the SLO if ttft <= ttft_slo and its tpot <= tpot_slo. A request with out_tokens <= 1 has no inter-token gap: its tpot is NaN and only the TTFT check applies. Return a dict {"goodput_rps": met / window_s, "attainment": met / n (0.0 when there are no requests), "good_tokens_per_s": total out_tokens of the requests that met the SLO / window_s}.
def slo_goodput(ttft, tpot, out_tokens, ttft_slo, tpot_slo, window_s)Example
ttft [0.2, 0.5, 0.1], tpot [0.03, 0.02, NaN], out_tokens [100, 50, 1], ttft_slo 0.3, tpot_slo 0.05, window 10 gives {"goodput_rps": 0.2, "attainment": 0.6667, "good_tokens_per_s": 10.1}.
Understand the idea
Goodput is like counting only the pizzas delivered hot. A shop can deliver 100 pizzas an hour, but if 40 arrive cold, customers feel 60. For LLM serving, hot means two things: the first token came fast enough (TTFT) and the following tokens kept a steady pace (TPOT, time per output token). Worked example: three requests in 10 seconds. One meets both targets with 100 tokens, one misses TTFT, one is a single-token reply that meets TTFT. Met = 2, goodput = 0.2 requests per second, attainment 2 / 3, good tokens 101 / 10 = 10.1 per second. Rule: good if ttft <= T1 and (tokens <= 1 or tpot <= T2). Serving benchmarks increase load until attainment drops below a target such as 90 percent and report the goodput at that point.