← Concepts

阅读中文版本

Tail Latency

Tail latency is the slowest fraction of requests — p99, p999 — and in fan-out systems it dominates user experience, because one slow component holds every page that touches it.

performance

Definition

Tail latency describes the high percentiles of the latency distribution. Averages hide it; p99 and above expose it. Its importance scales with fan-out: a page querying 100 backend calls sees the worst of them nearly every time, so a 1-percent tail at the component becomes a near-certain user experience at the page.

Context and scope

Measured on APIs, databases, and CDNs as p95, p99, p99.9. Drives hedged requests, timeout budgets, and the SRE focus on percentiles over means.

Common misconceptions

  • Average latency captures user experience — a p50 of 50ms with a p99 of 8s means users frequently wait; the mean reports neither
  • Faster hardware fixes tails — tails are usually variance: GC, lock contention, cache misses, retries, and noisy neighbors
  • The tail is a fixed cost of scale — tail-tolerant design — hedging, degradation, replication — measurably bends the curve

Anti-patterns

  • Reporting only means and medians in dashboards while users complain about freezes the aggregates never show
  • Setting timeouts above the observed tail, letting the slowest calls hold the whole request
  • Treating p99 as noise to be averaged away instead of a population of real users who always land there

Related concepts

Related examples

Authoritative source

https://research.google/pubs/pub40801/

What it is

Latency distributions are long-tailed: a small fraction of requests take many multiples of the median. That fraction is not noise — it is a consistent population, and at scale it is a large absolute number of users.

How it works

Fan-out amplifies tails: a page making 100 parallel calls completes at the maximum of the 100, so a 1 percent slow-call rate means most pages wait on a slow call. Queueing theory explains why variance itself inflates tails under load — utilization approaching saturation multiplies wait-time variance.

When to optimize

Any interactive service. Find the variance sources: GC pauses, lock queues, cold caches, retry storms, background jobs. Then apply tail-tolerant techniques — hedged requests, request-level timeouts, graceful degradation, and load-shedding — rather than trying to make every component uniformly fast.

Pitfalls

Percentile arithmetic is subtle: averaging percentiles across time windows misstates the true aggregate; compute from histograms. Small-sample p99s are noise — aggregate enough requests. Coordinated omission hides tails when measurement intervals wait for slow responses.