Scalingp2ctwo random choicesleast request

Power of two choices

Definition

Power of two choices samples two backends uniformly at random and chooses the one with fewer requests in flight; its worst-case imbalance is exponentially smaller than picking one at random.

In practice

It needs load information about only two servers, so it works well with many independent balancers or client-side load balancing where nobody has a global view. Envoy's LEAST_REQUEST uses it by default. Because each balancer samples randomly, they do not all pick the same idle server at once, which avoids herding.

It is slightly less even than a perfect global minimum, and like least connections it is fooled by a backend that fails fast and so appears lightly loaded; combine it with outlier detection. With long-lived or multiplexed connections, count requests rather than connections, or the signal says little about load.

Example

Twenty sidecar proxies each pick two of 50 backends at random per request and choose the one with fewer outstanding requests; P99 latency drops from 180 ms with round robin to 110 ms.