mathematics//statistics//percentile

A percentile is the value below which a given share of a distribution falls (the 99th percentile, or p99, of a latency is the time that 99 % of requests beat), and it is how engineers specify and judge quantities whose tails matter more than their averages: a loop's computation time, a network's latency, a robot's waiting time at a charger, the remaining life of a bearing. The median is the 50th percentile; the general term, for any share between 0 and 1, is **quantile**.


A percentile is the value below which a given share of a distribution falls (the 99th percentile, or p99, of a latency is the time that 99 % of requests beat), and it is how engineers specify and judge quantities whose tails matter more than their averages: a loop's computation time, a network's latency, a robot's waiting time at a charger, the remaining life of a bearing. The median is the 50th percentile; the general term, for any share between 0 and 1, is quantile.

The case for percentiles is that averages hide what sinks a system. A control task that takes 0.4 ms on average and 3 ms once an hour has a fine mean and a 1 kHz loop that misses its deadline once an hour. A fleet's charger that is free on average still makes some robots wait a long time when utilisation is high (queueing theory). And a predicted remaining life of 2,000 h means little to a planner; its 5th percentile, the life that 95 % of such bearings exceed, is the number a maintenance window is set by (remaining useful life).

Design and decide with high percentiles and the worst case, never the mean alone.

Specify p99 latency and the worst-case execution time, set error budgets as 95 % bounds, and plan maintenance on the low quantile of life (tails over means).

Fan-out multiplies the tail. A request that must wait for the slowest of 100 servers, each fast 99 % of the time, is slow 1−0.99100≈63%1-0.99^{100}\approx63%1−0.99100≈63% of the time; Dean and Barroso made this the core of The Tail at Scale (2013). The same arithmetic applies to a robot whose cycle waits on several sensors over a shared bus.

High percentiles need many samples. Estimating p99.9 means seeing enough points beyond it, and the relative error of a count of kkk rare events is about 1/k1/\sqrt k1/k​: with 100,000 samples there are 100 above p99.9 and the estimate is good to about 10 %, with 1,000 samples there is one, and it is a guess (sample size). The bootstrap puts an error bar on it.

Percentiles are robust where means are not. The median ignores a few absurd values that drag a mean anywhere (robust statistics), and percentiles stay meaningful for a heavy-tailed distribution whose mean is unstable. For a hard real-time guarantee even p99.999 is a statistic of what was observed; the bound itself is the worst-case execution time.

Percentiles do not add. The p99 of a sum of two delays is not the sum of their p99s (it is usually less, for independent delays), so an end-to-end latency budget is computed from distributions or by simulation (Monte Carlo method).