p95 and the average: why one response-time number is not enough
Updated:
A performance-test report says that the average response time is half a second. Customers may nevertheless report that some operations take substantially longer. Both statements can be correct: an average alone does not show how the individual response times are distributed.
The value of an average depends on the distribution of the values from which it was calculated. Website response times can have a long tail of slower requests.
This is why response times are measured in percentiles. p95 is the 95th percentile and p99 the 99th percentile of measured responses. In a report, they can be read as an approximate threshold for 95% and 99% of values respectively. Precision also depends on the calculation method. Compared with the average, they describe the slower tail of the distribution, but they do not show the individual slowest requests.
What the average hides
Imagine one hundred requests. Ninety-five of them complete quickly because they use a cache. The remaining five go to the database and wait for several seconds. The average for the hundred can still look acceptable even though five measured requests were substantially slower.
The fast cases pull the average down, and the slow cases disappear within one number. The report may then fail to reveal a portion of requests with disproportionately long response times.
An individual customer does not experience the average but the response time of their requests. Percentiles therefore help complete the performance picture, although they cannot by themselves determine the number or behaviour of customers without additional data.
How we measure
We evaluate response times with percentiles and other metrics. p95 estimates a threshold for approximately 95% of measured response times. If p95 is two seconds, the report describes that threshold in a particular sample using its chosen method. This does not automatically mean that the same share of customers had the same experience, because one person may send several requests.
- p95 describes an estimated response-time threshold for approximately 95% of measured requests. It is often used as one of the limits for an acceptable response time.
- p99 describes an estimated threshold for approximately 99% of measured responses. A deterioration can indicate a change in the slower tail of the distribution, which then needs to be investigated with other metrics, logs, or profiling.
We monitor percentiles together with the error rate and throughput. Response time alone is not enough: a system can reject some requests quickly and still report short response times. If system metrics are also available, we compare them on a shared timeline.
This comparison helps form a hypothesis about why p99 deteriorated. The timing relationship still needs to be confirmed with logs, profiling, a configuration review, or a repeated test after a targeted change.
Percentiles can be more sensitive to deterioration before the average changes significantly. We therefore monitor them together with the average, error rate, and throughput, not as the only number.
A concrete calculation shows p95’s limits too
Extend our earlier hundred-request example: 95 responses take 100 ms and five take 4,000 ms. The average is (95 × 100 + 5 × 4,000) / 100 = 295 ms. These are invented values for explanation, rather than a client measurement.
For this illustration, choose the simple nearest-rank method. Sort the values. Multiply the sample count by the percentile fraction (0.95 for p95) and round up to obtain the rank. With a hundred samples, p95 is the 95th value and p99 the 99th:
| Metric | Value in this model |
|---|---|
| Average | 295 ms |
| Median, p50 | 100 ms |
| p95 using the chosen method | 100 ms |
| p99 using the chosen method | 4,000 ms |
| Maximum | 4,000 ms |
p95 can therefore stay low even though the last five requests take a long time. In this case, p99 highlights the slow portion. Another method may calculate some percentiles differently. Do not treat the table as a particular tool’s default output.
Report the calculation method and sample count
NIST describes several percentile estimation methods, including interpolation. Two applications may therefore report slightly different numbers from the same data. Especially with small samples, displayed decimal places are not evidence of precision.
For twenty responses, nearest rank selects the highest value for p99. That number rests on a very small part of the observations. State sample count, distribution and measurement conditions. There is no single suitable minimum for every scenario and required confidence.
If a percentile comes from a histogram, check resolution too. Wide intervals may give a coarser estimate. When deciding close to a threshold, compare calculation precision with the underlying data. A few milliseconds’ improvement may not be a reliable difference if the measurement method changed too.
Separate operations, phases and time boundaries
Evaluate search, image loading and order creation according to their purposes. A combined p95 may hide deterioration in a rare critical operation. When comparing runs, preserve the scenario mix and distinguish ramp-up, steady load, peaks and recovery.
A long summary window may hide a brief issue. A shorter window shows it more clearly, but contains fewer observations at low traffic. State its duration and whether the cache is cold or warm. Selecting a phase must not silently exclude behaviour that belongs to the test objective.
Name the metric itself too. In k6, http_req_duration includes sending, waiting and receiving, excluding initial DNS and connection establishment. It is not automatically the time until a customer finishes a whole page or purchase. Compared values need matching units and time boundaries.
Server percentiles cannot be averaged
Averaging two p95 values does not generally calculate p95 across all requests. Weighting those percentiles by sample count alone does not solve this. You need the combined distribution of original observations or suitably aggregated histograms. Prometheus explains the limits of aggregating precomputed percentiles and the use of histograms.
When combining data, preserve the operation, units, period and compatible bucket layout. If only individual server percentiles are available, report them separately rather than inventing a combined percentile. An overall mean can be calculated from total duration and total count, but that procedure does not apply to p95.
Better p95 must accompany completed work
Record whether response times include successes, errors and timeouts. Show quick rejections and operations without the expected outcome separately. Filtering slow failures may improve the successful-response graph without improving the service.
Verify achieved load too. Unstarted k6 iterations are not completed operations whose response time a report could establish. Read the result alongside completed-operation count, error rate and correct data.
A decision report therefore needs the scenario and phase, calculation method, time window, sample count, percentiles and open limitations. After repair, compare matching conditions and investigate the relevant slow requests. Load-test measurement explains the wider set of metrics.
What you gain
You get a more complete description of the measured response times than a single average provides. When system capacity is evaluated, percentiles help assess the threshold not exceeded by a selected share of requests under a particular load. By themselves, however, they do not show the individual slowest requests or the group of customers to whom those requests belonged.
You also get better evidence for agreeing response-time limits, for example in an SLA. The average can look acceptable even when the threshold of the slower tail deteriorates. Values of p95 or p99 can reveal such a change.
If system metrics are available during the test, we can compare worse response times with, for example, SQL-query duration, waits for database connections, or server utilisation and propose the order of further investigation.
Next step
If you have only an average response time, add at least p95, p99, the error rate, throughput, and the sample count to the report. Always interpret the results in the context of the specific scenario and load. If you are also interested in backend behaviour under load, see API testing.