Try
↑ ↓ move↵ openesc close
In this lesson · topic 4 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 4

Why light load hides a bad balancer

6 min read

The numbers on this page are averages over eight seeded simulator runs, and a test pins each one. Hover a value for its exact setup.

The tail gap at high load

Eight servers, arrival rate at 0.85 of capacity, the same arrival stream for every strategy. The 99th percentile latency, in units of one mean service time:

Strategy p99 latency
Random 56.7 tmeasured
Round robin 49.6 tmeasured
Power of two choices 16.4 tmeasured
Least connections 12.2 tmeasured

Round robin has a better median than random (3.5 tmeasured against 5.7 tmeasured), because it spreads arrivals evenly. At p99 the two are close. A plausible reason is that the tail here is made by long requests blocking the queue behind them, and round robin does nothing about that. Queue-aware strategies cut the tail by a large factor. Power of two choices gets most of the way to least connections while asking two servers per request.

Light load hides the problem

At 0.40 of capacity the same experiment gives random a p99 of 16.5 tmeasured against 8.9 tmeasured for power of two choices. The gap is still there but much smaller than at high load. If you only benchmark a lightly loaded system you will conclude the strategy does not matter.

Unequal servers

Round robin is perfectly fair in request counts, which is the wrong thing to be fair about when servers differ in speed. With the speed spread raised to 0.30, round robin’s p99 after a short run is 87 tmeasured and after a run four times longer it is 266 tmeasured. It keeps rising because the slowest server is receiving more work than it can finish, so its queue never stops growing. Power of two choices under the same conditions reads 18 tmeasured and then 18 tmeasured. It adapts, because a slow server’s queue is longer and it loses the comparison.

What no strategy fixes

Past capacity, nothing helps. At an arrival rate of 9.43 per tmeasured against a capacity of 7.86 per tmeasured, least connections finishes 7.89 per tmeasured. Throughput sits at the capacity, and the rest of the work piles up in queues. The fix there is more servers, less work, or shedding load.

Stale information

Queue-aware strategies rely on queue counts being fresh. If many balancers act on the same old numbers, they can all send their next request to the same apparently quiet server at once. Power of two choices softens this because each balancer looks at a different random pair. The simulator keeps one balancer with perfect information, so it does not show this failure. It is a real one, and worth knowing for interviews.

Why the tail matters

A single user request often fans out to many servers and waits for the slowest answer. Then the tail of each server decides the typical user experience. The Tail at Scale paper by Dean and Barroso is the standard reference.

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