Try
↑ ↓ move↵ openesc close

Interview prep / Load balancing

Mid · Load balancing · System design interview question

Explain the power of two choices. Why does asking just two servers help so much?

Sketch your own answer first, then compare it with the one below.

A strong answer

Choose two servers uniformly at random, compare their current load, and send the request to the lighter one.

The intuition comes from balls and bins. With one random choice, the heaviest bin ends up noticeably above average because of random clumping. With two choices, any bin that is already heavy tends to lose the comparison, so the heaviest bin grows much more slowly. The improvement from one choice to two is large. Further choices add comparatively little.

The practical value is cost. It needs two probes per decision rather than a scan of all servers, so it scales to large pools and works with many independent balancers, each picking its own random pair.

Its limits are real. It relies on a reasonably current load signal, it cannot help when total load exceeds capacity, and when requests differ in cost the signal should reflect work rather than raw connection count.

Sources

Learn it by running it

The load balancing lesson explains the mechanism behind this question, and its lab lets you change the parameters and watch the effect.

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