Load balancer
Play this lessonThis lesson comes with an interactive animation you can break, a live-code challenge and a chapter quiz.A load balancer spreads incoming traffic across a group of web servers.
- Users connect to the load balancer's public IP. The web servers are no longer reachable directly from the internet.
- The load balancer talks to the servers over private IPs, which only work inside the same network. That's better security.
- If server 1 goes offline, traffic is sent to server 2. That's failover. Add a new healthy server to restore balance.
- Traffic growing fast? Add servers to the pool and the load balancer starts sending them requests automatically.
A common strategy is round robin: server 1, server 2, server 3, server 1… Load balancers also run health checks so they never send users to a dead server.
Key takeaways
- Load balancer = one public entry point, many private servers behind it.
- Solves both availability (failover) and capacity (add servers).