Try
↑ ↓ move↵ openesc close
In this lesson · topic 6 of 7
  1. 1. Why queues form
  2. 2. Four ways to pick a server
  3. 3. Race four strategies on one arrival stream
  4. 4. Why light load hides a bad balancer
  5. 5. The knee in the queueing curve
  6. 6. Fan-out turns a 1 percent tail into 63 percent
  7. 7. Pick the strategy for the fleet

Topic 6

Fan-out turns a 1 percent tail into 63 percent

7 min read

A search page, a feed or a product listing rarely calls one backend. It calls dozens or hundreds in parallel and waits for the slowest. That changes which latency number matters.

The arithmetic of waiting for everyone

Suppose each backend is slow on 1 percent of calls, meaning above some threshold such as one second. If a user request calls one backend, 1 percent of users see a slow page. If it calls 100 backends and needs all of them, the page is fast only when all 100 calls are fast:

0.99^100 ≈ 0.366

So 63 percent of user requests hit at least one slow call. The Tail at Scale paper uses this exact example. Rarer events fan out the same way. If only 1 call in 10,000 is slow but the request touches 2,000 backends, 1 − 0.9999^2000 ≈ 18 percent of requests are slow, almost one in five.

Predict first

Each backend is slow on 1 percent of calls. A request must wait for 10 of them. About what share of requests is slow?

This is why a p99 that looks fine on a single-server dashboard can still produce a slow product. The tier above it multiplies the chance of meeting the tail.

Hedged requests

A hedged request answers the tail directly. Send the call to one replica. If no reply has come back after a short delay, send the same call to a second replica and use whichever answers first.

The delay sets the cost. If you wait until the 95th percentile of the normal latency, only 5 percent of calls ever send a second copy, so the extra load is about 5 percent. The paper gives a measured case: reading 1,000 values spread over 100 servers, a hedge after 10 ms cut the 99.9th percentile of the whole read from 1,800 ms to 74 ms, for 2 percent more requests.

A related idea, the tied request, puts the copy in two queues at once and has each copy tell the other when it starts, so the second one is cancelled and the work is done only once.

Hedging has conditions:

  • There must be a replica. Hedging does not help if the slow call is the only copy of the data.
  • The call must be safe to run twice. Reads are fine. Writes need to be idempotent.
  • There must be headroom. The extra 5 percent of load is not free. At 85 percent utilization it moves the fleet to about 89 percent. On the M/M/1 curve from the previous topic that takes the mean time from 6.7 t to 9.3 t. A fleet near the knee can lose more than hedging gains.

Hedging also fails if the cause of slowness is shared. When all replicas are slow because of one overloaded dependency, the second copy only adds to the pile.

Fewer calls beats faster calls

The other lever is the fan-out itself. A request that can accept partial results after a deadline, or that reads from 10 backends instead of 100, escapes most of the tail. The fan-out arithmetic says the cheapest slow call is the one you did not make.

Sources

  • Jeffrey Dean and Luiz André Barroso, The Tail at Scale, Communications of the ACM, 2013.

Your progress is saved in this browser. Sign in to keep it on every device. Privacy · Terms