p95 latency is the response time that 95% of requests beat. If your p95 is 300 ms, one request in twenty takes longer than 300 ms. The average (the mean) adds up every response time and divides by the count, and a few very slow requests barely move it.
That is why teams set targets on p95 or p99 instead of the average: the average describes a request almost nobody complains about, and the p95 describes the ones they do.
The experiment
One load balancer and a pool of four small instances, which together can serve about 1,200 reads a second. We ran it at seven steady loads, from 30% busy to 95% busy, and recorded the mean, the median (p50) and the p95 once each run had settled.
Latency as the pool gets busier
- p95
- p50 (median)
- Mean
| Pool busy | Mean | p50 | p95 | Errors |
|---|---|---|---|---|
| 30% | 27 ms | 26 ms | 42 ms | 0% |
| 50% | 32 ms | 31 ms | 52 ms | 0% |
| 65% | 43 ms | 41 ms | 73 ms | 0% |
| 75% | 61 ms | 51 ms | 135 ms | 0.2% |
| 85% | 106 ms | 71 ms | 309 ms | 1.7% |
| 90% | 164 ms | 97 ms | 524 ms | 3.1% |
| 95% | 343 ms | 179 ms | 1,165 ms | 5.4% |
What moved, and how fast
At 30% busy, the three numbers tell the same story: 27 ms on average, 42 ms at the p95. Nobody would argue about which one to watch.
From 30% to 90% busy, the mean went up about six times, from 27 ms to 164 ms. The p95 went up about twelve times, from 42 ms to 524 ms. The tail grew twice as fast as the average, and the gap kept widening: at 95% busy the p95 was 1.2 seconds while the mean still read 343 ms.
The median is the most flattering of all. At 90% busy, half of all requests still finished in under 97 ms. A dashboard showing the p50 would have looked fine right up to the point where one request in twenty took over half a second.
Why the tail grows first
When a server is mostly idle, a request arrives, gets handled, and leaves. When it is busy, a request sometimes arrives right behind a few others and has to wait for them. Most requests are still lucky; some are not, and the unlucky ones wait longer the busier things get. The average is dominated by the lucky majority, so it rises slowly. The p95 is, by definition, about the unlucky ones.
That is also why the errors start where they do. The first errors here appeared at 75% busy, the same point where the p95 started pulling away from the mean. Long before a system fails, its tail gets slow.
Why one slow request in twenty is worse than it sounds
A single page often makes many backend calls. If a page needs 20 calls and each has a 5% chance of being slower than the p95, the chance that at least one of them is that slow is 1 − 0.9520, about 64%. Most page loads include a p95-slow call. The tail of each service is the typical experience of the user.
Which number to watch
Use the p95 (or p99, for high-traffic services) for targets and alerts. Keep the mean for capacity maths and cost, where totals matter. Look at the p50 to see what a typical request feels like, and never on its own.
And keep headroom. In this run, going from 65% to 85% busy took about a third more traffic, and it quadrupled the p95.
How InfraSim gets a p95
InfraSim does not time individual requests: it models traffic as flows per tick. For each path through the system it computes the average latency and how spread out it is, with the spread growing as components get busy, and fits a distribution to those to get the p50 and p95. The mean in the table is that same average. So these numbers show the shape the model produces, with a fixed seed, not a measurement of a real server.
Break it yourself
Advent of Outages door 21, "Bad Timing" ships a release at the busiest minute and takes half the servers out of rotation to do it, which pushes everything up this curve at once. It is free in your browser with no account; the door opens on 21 December and stays open after.
In the InfraSim app, Fast Enough (chapter 1, Requests & Routing, free) is a system that answers every request and is still too slow, because one instance is busy enough that requests queue behind each other.
You can play Fast Enough in your browser right now, along with the rest of the first five levels. No install, no account.