Lab · Traffic
Load balancer
A load balancer sits in front of several identical servers and decides which one handles each request. Watch how the algorithm, a slow server and a crash change where requests go — and who gets errors.
Try it
- Clients — 6 IP addresses — healthy — 6 req/s
- Load balancer — Round robin — healthy — checks every 2 s
- Server A — in pool — healthy — 2 busy · 8 sent
- Server B — in pool — healthy — 2 busy · 8 sent
- Server C — in pool — healthy — 3 busy · 8 sent
- Request
- Response
- Error / rejected
- Health check
Numbers add up:25 requests = 17 succeeded + 0 failed + 8 in flightThe lab checks this sum as it runs, so a counting mistake would show here.
Controls
Next server in order, one at a time.
Follow a request
Pause to pick a request that is on screen.
Where requests went
The tick mark shows an equal 33% share.
What just happened
- 0.0sInfo: Load balancer started with 3 servers using Round robin.
Compare two algorithms on the same requests
Both sides get the same requests at the same moments, from the same clients. Only the algorithm differs, so any gap in the numbers comes from the algorithm. Both sides start with 20 seconds already run.
Next server in order, one at a time.
Send to the server with the fewest requests in progress.
- Clients — 8 req/s — healthy
- Load balancer — Round robin — healthy
- Server A — normal — healthy — 2 busy · 34%
- Server B — 4× slower — SLOW — 9 busy · 33%
- Server C — normal — healthy — 2 busy · 33%
- Clients — 8 req/s — healthy
- Load balancer — Least connections — healthy
- Server A — normal — healthy — 3 busy · 46%
- Server B — 4× slower — SLOW — 3 busy · 16%
- Server C — normal — healthy — 2 busy · 38%
- A request on its way
- Its reply, moving back up
- Refused: the server was full
Each box is one request, named after its client: 0.13 is the client at 10.0.0.13. Each side draws only a few at a time, so the boxes stay easy to follow. The table counts every request.
| Measure | Side 1 · Round robin | Side 2 · Least connections | Gap |
|---|---|---|---|
| Requests sent | 164 | 164 | Same requests |
| Succeeded | 147 | 155 | Least connections higher by 8 |
| Failed | 3 | 0 | Least connections lower by 3 |
| p50 latency (median) | 1.3 s | 1.3 s | Same |
| p95 latency (slowest 5%) | 4.5 s | 3.0 s | Least connections lower by 1.5 s |
| Share sent to server B | 33% | 16% | Least connections lower by 17 points |
Changing a setting starts both sides again, so the numbers always describe one setup from its start. A server rejects a request when it already has 10 in progress.
What this model simplifies
- Time is slowed down so you can follow each request: a network hop takes ~0.2 s here instead of well under a millisecond.
- Servers get slower as they get busier (+12% per concurrent request) and reject work beyond 10 concurrent requests. Real servers degrade in less tidy ways.
- The load balancer itself never fails. In production you run at least two, behind DNS or a floating IP.
- Health checks are simple "are you alive?" probes. Real checks often hit an endpoint that also verifies dependencies.