Definition
A tail percentile §11.16 is a high percentile of a set of measurements, such as p99, the 99th percentile: the value that at least 99% of the measurements do not exceed. It summarizes the slow end, called the tail, of a latency distribution §11.36. A small sample supports a tail percentile with very few measurements. The sample p99 of 30 measurements is simply the largest one, and it estimates the true p99 of the measured process only loosely.
Where it fits
Main entry: Quantile and percentile (§11.16).
The quantile and percentile entry defines percentiles and the rules for computing them from data. Under the nearest-rank rule, the sample percentile at level , a fraction between 0 and 1, is the measurement at position in the sorted list of measurements, where means rounded up to a whole number. For and , rounds up to 30, so the sample p99 is the largest measurement. This holds for every below 100, because then exceeds .
The linear rule of the quantile entry instead places the p99 of 30 measurements at position and gives , where is the th smallest measurement: a value between the two largest measurements, decided by those two alone. On an ECDF §11.17 (empirical cumulative distribution function, the curve of the fraction of measurements at or below each value), each of 30 measurements is a step of , about 3.33 percentage points, too coarse to separate the 97th, 98th and 99th percentiles.
How far a sample p99 can miss follows from counting. Assume that the measurements are independent and identically distributed §11.5 (IID), each drawn separately from the same process, and that the durations have a continuous distribution, in which every single exact value has probability zero. Each measurement then lies below the true p99 with probability 0.99, and all 30 lie below it with probability ; then even the largest measurement, the reported p99, is below the true p99. The largest of measurements is at least the true p99 with probability , which first reaches 0.95 at , since and .
Limits and common mistakes
A sample p99, and even a sample maximum §18.5.9, is not a worst-case bound: a rare slow event that did not occur during the measurements leaves no trace in either.
More rows are not more independent measurements. If a slow condition, such as start-up work at the beginning of each run, affects a whole run at once, 3000 timings taken as 100 from each of 30 runs tell about as much about that condition as 30 measurements. Treating them as 3000 independent measurements is pseudoreplication §11.6.
The count of 299 gives only a one-sided statement: the largest measurement is at least the true p99 with probability 0.95. It says nothing about how far above the true p99 that measurement lies, and no count makes a p99 precise for every distribution.
Questions answered
How many samples support this p99?
Very few: only the largest few of the measurements, or samples, decide a sample p99, the 99th percentile. Under the nearest-rank rule it is the measurement at position of the sorted list, where means rounded up, so at most measurements lie above it. For any below 100 it is the single largest measurement; with 30 measurements, a p99 marker rests on one value.
Suppose the measurements are independent and drawn from one continuous distribution, in which no exact duration has positive probability. The largest of measurements is then at least the true p99 with probability : only for 30 measurements, and it first reaches 0.95 at 299 measurements. A figure should therefore state the count, the percentile rule and what counts as one independent measurement.
Related entries: Pseudoreplication (§11.6), Latency distribution and tail (§11.36), Central limit theorem (§15.45), Empirical cumulative distribution function (ECDF) (§11.17), Independent and identically distributed samples (§11.5).