All glossary terms

Serving

Tail latency

The wait the slowest requests get, read at p95 or p99. A flat median beside a blown tail is the signature of a capacity problem, not user behavior.

The median hides what the slowest users live with. Percentiles such as p95 and p99 ask a different question: read the requests from fastest to slowest and name the wait at the 95th or 99th position, so the handful of stragglers - the ones a churned user notices - decide the number. That is why service level agreements quote p95 or p99 and never the median: the tail is where the complaint emails come from.

Two shapes tell different stories. A p95 that rides up with the p50 means everything got slower - a slow model version, a bad cache day. A p50 that stays flat beside a rising p95 means the typical request is fine and a shrinking minority is queueing behind something: a batch of long prompts, a card at saturation, an eviction storm. That second shape is the one that hides until percentiles are measured, and it usually has an infrastructure answer rather than a code one.

Nearest-rank is the honest way to read it from raw samples: sort the waits and take the value at position ceil(0.95 x n), counting from one. With ten samples that is the 9th smallest, so one wild outlier cannot claim the position - which is also why a single 5-second blip in ten requests can raise p99 while leaving p95 untouched, and why both are read together.

A worked example

1,000 requests in a minute. Nearest-rank percentiles: each band is read by rank, where rank r of n is the r-th smallest sample.

  1. The bands: 950 requests land under 400 ms, 40 land between 400 and 900 ms, and 10 land above 5,000 ms during a burst.
  2. p95 is rank 950: the top of the fast band, about 400 ms - a number a healthy median story would happily report.
  3. p99 is rank 990: the top of the middle band, about 900 ms - and the 10 requests above it are over 5,000 ms.
  4. The p50 of the same minute sits well inside the fast band and moved almost none while the tail tripled.

p95 of 400 ms hides it, p99 of 900 ms names it, and 10 users live at 5,000 ms - the wait the median never sees and the users who complain do.

Where this shows up

Related terms