P95 latency meaning: what is the 95th percentile?
p95 latency is the 95th percentile of response times: 95% of requests were as fast or faster, and the slowest 5% took longer. Unlike the average, it shows what the slow end of your traffic experiences, which is why SLOs and alerts usually use p95 or p99. With 20 sorted samples, p95 is the 19th value by nearest rank.
Why p95 latency matters
Averages hide tails. If 95 requests take 100 ms and 5 take 4 seconds, the mean is 295 ms, which describes nobody. p95 shows the slow group directly.
Users make many requests per page and per session, so most of them hit the slow tail sooner or later. A p95 regression after a deploy is often the first sign of a missing index or a slow dependency.
How to measure p95 latency
nearest-rank p95: sort the n values and take the value at rank ⌈0.95 × n⌉ (many tools interpolate between neighbouring values instead, so small samples can differ slightly)
Worked example
Twenty requests took, sorted: 75, 85, 88, 90, 91, 95, 97, 99, 102, 105, 110, 112, 118, 121, 130, 142, 160, 210, 480 and 1,250 ms.
- Rank = ⌈0.95 × 20⌉ = 19.
- The 19th value is 480 ms, so p95 = 480 ms.
- The median is the average of the 10th and 11th values, (105 + 110) ÷ 2 = 107.5 ms, and the mean is 188 ms, pulled up by a single 1,250 ms request.
Result: Half the requests finish in about a tenth of a second, yet one in twenty takes nearly half a second or more. That is what p95 is for.
p50 vs p90 vs p95 vs p99 on the same 20 requests
The worked example's 20 response times, read at four percentiles. Two methods are common: nearest rank picks a real sample (rank ⌈p × n⌉), and linear interpolation blends the two closest samples, which is what PostgreSQL's percentile_cont and numpy's default do. With only 20 samples the two disagree a lot at the tail; with thousands they converge.
| Percentile | Nearest rank | Interpolated (percentile_cont) | What it tells you |
|---|---|---|---|
| p50 | rank 10 → 105 ms | 107.5 ms | the typical request (median) |
| p90 | rank 18 → 210 ms | 237 ms | where the slow tail starts |
| p95 | rank 19 → 480 ms | 518.5 ms | what 1 request in 20 is slower than |
| p99 | rank 20 → 1,250 ms | 1,103.7 ms | the rare worst cases; needs lots of traffic |
Notice how far apart p90 and p99 are: the median is about a tenth of a second while p99 is over a second. Reporting one number hides that spread, which is why dashboards usually plot p50, p95 and p99 together.
p95 vs average (mean) latency
The mean of the 20 samples is 188 ms. Drop the single 1,250 ms request and it falls to 132.1 ms, a change of 55.9 ms caused by one request out of twenty. The median barely moves, and p95 still points at the slow group. That is the core argument for percentiles: the mean mixes fast and slow requests into a value that describes neither, and one outlier can move it more than a real regression.
The average is still useful for capacity: total time spent = mean × request count, so it tells you how busy your workers are. Use the mean for cost and throughput, percentiles for user experience and alerts.
How to compute p95 in Prometheus, SQL and code
Prometheus (histogram metrics): histogram_quantile(0.95, sum by (le) (rate(http_request_duration_seconds_bucket[5m]))). The result is interpolated inside a bucket, so its accuracy depends on your bucket boundaries: if the buckets are 0.25 s and 0.5 s, every p95 between them is a guess. Put bucket edges near your target (for example 0.3 s).
PostgreSQL: SELECT percentile_cont(0.95) WITHIN GROUP (ORDER BY duration_ms) FROM requests WHERE ts > now() - interval '1 hour'; interpolates; percentile_disc(0.95) returns a real sample, like nearest rank.
Python: numpy.percentile(x, 95) interpolates linearly; with the standard library, statistics.quantiles(x, n=100, method="inclusive")[94] gives the same value. The default method="exclusive" gives a different one, so say which method you use when you compare numbers.
Never average percentiles. The p95 of five servers is not the mean of their five p95s. Merge the raw data or the histograms, then compute the percentile once.
What is a good p95 latency?
There is no universal number; the right p95 depends on what the request is for. Work it out in three steps:
- Measure today's p50 and p95 per endpoint over a week, so you know what normal looks like, including busy hours.
- Ask what users notice. An autocomplete call that takes half a second feels broken; a report export that takes five seconds is fine.
- Write the target as a share of good requests, for example "95% of checkout requests finish within 400 ms over 28 days", which is an SLI you can put an SLO on.
Mind the sample size. With fewer than 20 requests in a window, nearest-rank p95 is simply the slowest request, so a p95 alert on a quiet endpoint is a max alert. Use longer windows or a minimum request count before alerting.
Common mistakes
- Averaging percentiles. The average of hourly p95 values is not the day's p95. Compute percentiles from raw data or histograms.
- Too few samples. The p95 of 20 requests rests on one value. Show the request count beside it.
- Mixing endpoints. A fast health check and a slow report in one series give a meaningless p95. Measure per endpoint.
- Ignoring p99. On a busy service the 1% beyond p99 can still be thousands of requests an hour.
How Vigil handles p95 latency
- Uptime monitors chart p50 and p95 response times, and adaptive latency alerts learn a 7-day baseline and open a degraded incident on anomalies.
- Vigil's APM keeps a latency histogram per endpoint, so percentiles are computed from the distribution rather than averaged, and the server agent can alert on an endpoint's p95.
- Real user monitoring reports Web Vitals at p75, the percentile Google uses to assess them.
p95 latency: frequently asked questions
What is the difference between p95 and p99?
p95 is the value 95% of requests beat; p99 is the value 99% beat. p99 shows rarer, slower requests and needs more traffic to be stable.
Why not use the average?
A few very slow requests pull the average up while most users see something faster, and a slow minority can hide behind a fast majority. Percentiles describe actual experiences.
What is a good p95 latency?
It depends on the endpoint. Define it from what users expect, write it into an SLO such as "95% of requests under 300 ms", and alert when you drift from it.