System Design · Concept Library · Free article
p99 & Percentiles
Why an average can hide slow requests, and how p50, p95, and p99 describe a latency distribution.
p99 is a latency threshold for measured operations. Sort the requests in a stated window; under the nearest-rank definition, p99 is the value at or below which 99% completed. The remaining 1% were slower. It describes requests, not necessarily users, because one user can make many requests. Teams choose p95, p99, or another target based on traffic volume and risk.
Why an average can hide slow requests
Imagine 100 page loads. Ninety-nine finish in 50 ms, while one takes 5,000 ms after hitting a slow path.
The average is (99 × 50 + 5000) ÷ 100 ≈ 99 ms. That number does not show that one request took five seconds. The calculation is valid; it summarizes the distribution differently. Percentiles make the slow tail visible.
What a percentile is
Take every measured request from a stated time window and sort the latencies from fastest to slowest. Under the nearest-rank definition, p99 is the value at rank ceil(0.99 × N).
If p99 is 240 ms, at least 99% of those requests finished in 240 ms or less. The remaining requests were slower.
The pXX notation names the cut-off
- p50 is the halfway point, also called the median. It represents the typical request.
- p90 / p95 / p99 move progressively deeper into the slow tail.
- p99.9 / p99.99 are useful at a scale where even 0.1% still means many requests.
Reading the numbers
| Percentile | Means | Part of the distribution | You use it to… |
|---|---|---|---|
| p50 (median) | At least half of requests are at or below it | The middle measured request | Sanity-check the common path |
| p90 | At least 9 in 10 are at or below it | The slower tenth begins beyond it | Catch the early edge of the tail |
| p95 | At least 19 in 20 are at or below it | The slower twentieth begins beyond it | Set a moderate tail target |
| p99 | At least 99 in 100 are at or below it | The slower 1% begins beyond it | Track a deep but recurring tail |
| p99.9 | At least 999 in 1,000 are at or below it | The slower 0.1% begins beyond it | Inspect rare latency at large scale |
Read p50 and p99 together. A low p50 with a high p99 means the common path is fast but a small share of requests are much slower. Neither number alone proves the whole system is reliable.
Why the tail matters more at scale
At 100 requests a day, 1% is one request. At 10 million requests a day, 1% is 100,000 requests. The percentage is unchanged, but the number of affected operations grows with traffic.
Fan-out can push a parent request deeper into the tail. A page may call several dependencies and wait for the slowest call on its critical path. With independent latency distributions, adding calls creates more chances that one is slow, so the parent distribution often shifts right. Correlation, retries, and which calls are truly required all affect the result. Drag the illustrative slider below:
The interactive version of this example is available when JavaScript loads.
p99 vs average vs max
| Measure | What it tells you | Why it can mislead |
|---|---|---|
| Average (mean) | Overall central speed | Hides the tail: a few slow requests vanish into the crowd |
| Max (p100) | The single worst request | One unusual observation, such as a GC pause or network loss, defines it |
| Percentiles (p95/p99) | A chosen point in the slow tail | The chosen percentile may still omit rarer but important requests |
Average smooths away the tail; max is controlled by one observation. A percentile gives a chosen cut-off between them. There is no universal default: teams select p95, p99, p99.9, or threshold compliance based on volume and risk.
How p99 is measured
A percentile needs a population and a time window, such as "p99 over the last 5 minutes." Dashboards often calculate that window repeatedly and plot the result over time.
How to investigate a high p99
A high p99 with a low p50 means most requests are fast but a smaller group follows a slower path. Break down those requests by route, region, dependency, cache state, and queue time before choosing a fix.
Common causes of tail latency
- Distance & round-trips: a request crossing the globe pays the travel time on every trip; distance is a latency floor no amount of faster code can remove.
- Cold caches: the first request after eviction does the slow, full work.
- Queueing: under load, requests wait behind others before any work starts.
- Garbage-collection / pauses: the runtime freezes for a few ms at unlucky moments.
- Retries & lock contention: a request that retries or waits on a lock silently doubles its time.
- Noisy neighbours: a shared machine gets briefly hogged by someone else.
Tools that pull the tail back in
- Cut round-trips / move closer: caches, CDNs, regional replicas (shorten the distance).
- Hedged requests: send a duplicate to a second replica and take whichever answers first; the slow one no longer decides your p99.
- Timeouts + bounded retries: cap how long any one slow call is allowed to drag the request.
- Concurrency limits / load shedding: keep queues short so waiting time stays small.
- Autoscaling & capacity headroom: maintain enough capacity to avoid sustained queueing at expected load.
Common misconceptions
How p99 relates to an SLO
p99 is a measurement. A target such as "keep p99 under 150 ms" can be part of a Service Level Objective (SLO). The percentile describes the measured distribution; the SLO states the target and time window.
What to remember
Sources and further reading
By GOAT Engineer. Back to Concept Library. Privacy Policy · Contact.