tail latency
Imagine you ask ten friends a question and need all ten answers before you can act. Nine reply in a second, but one is in the shower and takes thirty seconds. You wait thirty seconds — the slowest friend, not the average, sets your experience. Now imagine your single web request actually fans out to a thousand servers and you need all of them to come back. Even if each server is fast almost always, the chance that at least one of the thousand happens to be slow this time is high — and that one straggler decides how long you wait. This is the tail-latency problem: at scale, the rare slow response, not the typical fast one, governs what the user feels.
The name comes from the shape of a latency distribution. Most responses cluster near a small typical time, but there is a long tail of occasional slow ones, caused by transient hiccups: a server doing garbage collection, a disk seek, a queue behind another request, a network retransmit, a background task stealing CPU. Engineers measure the tail with high percentiles — the 99th percentile (p99) latency is the time under which 99% of responses finish, and p999 the 99.9th. The math of fan-out is brutal: if a single server's p99 is, say, 10 ms, and a request waits on 100 such servers, the chance all 100 finish under 10 ms is roughly 0.99^100, about 37% — meaning roughly 63% of requests will be slowed by at least one straggler. The more you fan out, the more the tail dominates.
Tail latency is one of the defining challenges of warehouse-scale computing precisely because WSC work fans out so widely, and because users judge a service by its slowest visible moments, not its average. Architects fight the tail with techniques aimed at the stragglers rather than the average: send the same request to two replicas and take whichever answers first (hedged requests), set tight timeouts and retry elsewhere, isolate background work so it does not stall foreground requests, and over-provision a little to keep queues short. The goal is to make the 99th and 99.9th percentiles fast, not just the median.
The honest point beginners miss: optimizing the average is not enough, and can even mislead. A change that lowers mean latency while occasionally adding a long pause can make the user experience worse, because the tail is what hurts. At scale, 'usually fast' is not the same as 'fast' — a service that is fast 99.9% of the time can still feel slow if every page touches thousands of components, because almost every page will touch at least one of the slow 0.1%.
Each backend has a 1-in-100 chance of a slow (slow = 1 s) response. A request that touches one backend is slow 1% of the time. A request that fans out to 100 backends and waits for all is slow whenever any one is slow: about 1 - 0.99^100 = 63% of the time. The same per-server tail explodes once you fan out.
Fan-out turns a small per-server slow chance into a large chance that the whole request is slow.
Optimizing the average (median) latency is not enough and can mislead. Users feel the tail (p99, p999), and heavy fan-out makes almost every request hit at least one straggler.