Skip to content

Lesson 11 of 13 · 13m

Fan-Out Turns Your p99 into the Median

Dean and Barroso's 63.4% math, hedged requests that collapse the tail, and why instant retries become storms.

One server in your fleet is slow 1% of the time — a GC pause, a scheduler hiccup, a lock wait — so its p99 is 1 second while its p50 is 10 ms. Now build the request that fans out to 100 such servers, which is what a search query or a wide JOIN-shaped microservice call actually is. The user request finishes when the slowest sub-request finishes. The probability all 100 leaves dodge the 1% tail is 0.99¹⁰⁰ ≈ 36.6%. Invert it: 63.4% of user requests take ~1 second. The leaf's p99 became the fan-out's median.

That's the whole argument of Dean and Barroso's "The Tail at Scale" (Communications of the ACM, February 2013), written from Google's own serving data, and it's the reason "p99 is an edge case" is a model that fails at scale. At fan-out 100, the tail isn't the edge case — it's the request. The causes at the leaf are mundane and uncorrelated enough that you can't fix them one by one: a JVM compaction, a kernel reschedule, an L3 cache eviction pattern, a NIC interrupt landing on the wrong core.

Hedged requests

The paper's flagship mitigation is the hedged request: issue the sub-request, and if it hasn't returned by the leaf's p95 deadline, issue a second identical request to a different replica and take whichever answers first. In the paper's BigTable benchmark, hedging after a 10 ms delay cut the 99.9th-percentile read latency from 1.8 s to 74 ms at a cost of about 2% extra requests. That is a ridiculous trade — and it's the mechanism, not the number, that matters: the tail is jitter, and jitter doesn't replicate across two independent reads.

Hedging done wrong is a retry storm. If you hedge at a fixed short delay on a service that's slow because it's overloaded, you've doubled load onto the thing strangling itself. The paper's guardrails: hedge only after a delay at the high-percentile mark (the first request still wins ~95% of the time), cap hedged load per request, jitter the hedge deadline, and cancel the loser on a win so downstream work doesn't double-commit.

The other levers from the paper

Micro-partitioning cuts fan-out width: many small partitions let the average case route around the slow shard instead of every request touching every shard. "Good enough" responses — return the 95 leaves that answered and mark the result partial — trade completeness for latency where the product allows it. The paper also lists canary requests: probe a shard with a cheap request to detect a wedged replica before the real workload lands on it. Quarantine works for persistent slowness: a leaf that's been slow for minutes gets depooled and restarted, distinct from the jitter you hedge around. And the paper's opening observation is the one worth keeping on the wall: rare disruptions at the component level become the norm at the system level, and every mechanism here is a way to stop collecting them.

Retry ≠ hedge

A retry happens after failure or timeout and adds work serially. A hedge runs in parallel, before failure, precisely when the distribution says it's safe. Confusing them is how a GC pause becomes an incident: naive instant retries convert one server's bad second into correlated load across the fleet, and every other leaf's queue depth rises together.

Practice

  • Measure leaf-level percentile latency; the fan-out makes the leaf's p99 your product's median.
  • Hedge with a deadline at ~p95 of leaf latency, jittered, capped, and cancelling the loser.
  • Reduce fan-out width where you can; caching and micro-partitioning beat hedging at the architecture layer.
  • Alert on the fan-out's percentiles, not any single leaf's — one slow leaf is weather; a slow fan-out is climate.

The tail isn't a defect to eliminate. It's a statistical certainty to engineer around.

Was this lesson helpful?

Sign in to rate

Keep reading

Related articles from the SudoSecurity blog.