A load balancer sits in front of several servers and hands each new request to the next server in a fixed order: 1, 2, 3, then back to 1. It never looks at how busy a server is. Below, change the servers and the requests and see when taking turns spreads the work evenly and when it does not.
Each server drawn stands for one of your servers, and each dot for 100 real requests. Only the speed is slowed, so you can follow single requests: an ordinary request takes 1 second here. The load on each server is the real one from the sizing below. Requests arrive at random, as real traffic does, so the busy figures drift around that load rather than sitting on it.
Busiest hour vs the daily average. The book's estimate uses 2x.
Measured by load testing one server until it cannot go faster.
Headroom for spikes, slow requests and a failed server. 50 to 70% is common.
1. Average requests per second
2. Peak requests per second
3. Servers needed n
4. Load on each server with round robin
5. When they are not alike
More users means more servers, and each server's load stays near the target you set. Round robin behaves the same on 4 servers or 4,000 at the same load, so the animation only changes when the load does: through the target, the traffic right now, or rounding when the fleet is small.
Steps 1 and 2 are the estimation method from the back-of-the-envelope chapter of Alex Xu's System Design Interview, Vol. 1, including its 2x peak. Steps 3 to 5 are standard capacity planning: a server's load is the work it is given divided by the work it can do, and round robin gives every server the same number of requests whatever its speed. Losing one of n servers spreads the same traffic over n - 1.
Both make round robin the default, because it needs no knowledge of the servers at all.
weight on a server gives it more turns: in the guide's example, weight=3 on one of three servers sends it 3 of every 5 requests. Health checks are passive by default: after a failed request (max_fails, default 1) the server is skipped for fail_timeout (default 10 seconds), then tried again with real requests, as in the scene. Active health checks are part of the paid NGINX Plus.round_robin, least_outstanding_requests or weighted_random, and "The default is round_robin." The documentation also says the load balancer "routes requests to the registered targets that are healthy", so unhealthy targets drop out of the rotation. Least outstanding requests is AWS's answer to the slow-request problem above.Both are the vendors' own documentation (primary sources). Quoted sentences are short attributed quotations; everything else is described in our words. Defaults change between versions, so check the pages for current values.