The API dashboard says 135ms on average. An average adds every request up and divides, so a few very slow requests get spread thin across thousands of fast ones, and the people who actually waited disappear from the number.
Where the timer starts
Most backend metrics start the clock when a request reaches your server and stop it when your handler returns. Your user's clock starts when they tap the button and stops when the response is back on their screen, so it also includes the trip across the network, both ways.
- 1. Request travels to you 45ms
- 2. Your server handles it 135ms
- 3. Response travels back 70ms
Measured at the server: 135ms. The user waits 250ms.
Flip the toggle and the bracket grows from 135ms to 250ms. The server number is the one you can fix in code; the client number is what people actually feel. If you only track the server side, you'll keep getting surprised by complaints from people on bad connections, so add real-user timing from the browser or app as well.
Reading percentiles
Line up 100 requests from fastest to slowest. The 95th one is your p95: 95 requests took that long or less, and 5 took longer. p50 is the median, the request in the middle. p99 is the 99th, so only one request in a hundred is slower than it.
| Number | Slower than it | What it's good for |
|---|---|---|
| p50 | half | The typical request. If this moves, everyone feels it. |
| p90 | 1 in 10 | An early warning that a slice of traffic is getting worse. |
| p95 | 1 in 20 | A common target for alerts and SLOs on user-facing APIs. |
| p99 | 1 in 100 | The tail. What fan-out turns into an ordinary page load (more below). |
| p99.9 | 1 in 1,000 | Busy systems: at 10,000 requests a second, that's 10 slow ones a second. |
| max | none | Mostly noise from one GC pause or retry. Look at it, don't alert on it. |
p95 is 245ms: 5 of 100 requests were slower. The mean is 135ms.
Now switch on the slow dependency. It adds two seconds to 3 of the 100 requests, the kind of thing a flaky downstream service does to you:
| Number | Healthy | Slow dependency |
|---|---|---|
| mean | 135ms | 195ms |
| p50 | 123ms | 124ms |
| p95 | 245ms | 272ms |
| p99 | 275ms | 2,081ms |
The mean jumped by about 60ms. That's enough to make you look, but it reads like everything got a bit slower, which isn't what happened. The median moved by 1ms and p95 went up a little. p99 is the only number that shows three people waiting over two seconds.
So when you pick a percentile, you're also picking whose experience you'll ignore. Put your alert on p95 and the slowest 5 requests in every 100 can get as bad as they like without it ever firing.
Two traps when reading them. Don't average percentiles across hosts: five hosts' p95s averaged isn't the service's p95. Merge the histograms and take the percentile of that (most metrics tools do this if you query the histogram). And don't trust p99 on a quiet endpoint: with 50 requests in the window, p99 is just your slowest request, so use a longer window until you have a few thousand.
One slow call in a hundred
A page load is rarely one request. The page calls a handful of services, those call a few more, and the page can't finish until the slowest of them answers. If every call is slow 1% of the time, each call you add is one more chance to land on a slow one.
With 10 calls, about 1 page load in 10 is slow. With 100, it's nearly 2 in 3. Jeff Dean and Luiz Barroso described this at Google in The Tail at Scale, and it's why teams running big systems watch p99 and p99.9 so closely: once a page fans out wide enough, one service's p99 is what a normal page load feels like. The same maths works across a session. Someone who makes 50 requests in one visit has about a 40% chance of hitting your p99 at least once.
Next time a latency number lands in front of you, ask where the timer starts and what p99 looks like before you decide whether it's good.