What Is a Load Balancer?
You'll learn: How load balancers distribute incoming traffic across multiple servers to improve reliability and performance.
The Core Idea
A load balancer is a component that sits between clients (users) and your servers, distributing incoming requests across multiple backend servers. Instead of all traffic hitting a single server, the load balancer spreads the work evenly, ensuring no single server becomes overwhelmed.
Think of it like a restaurant host: when customers arrive, the host doesn't seat everyone at one table or with one waiter. Instead, they distribute diners across available tables and servers to balance the workload and provide better service.
Why Load Balancers Matter
When you use horizontal scaling (adding more servers), you need a way to route traffic to those servers. The load balancer acts as a single entry point that:
- Distributes traffic evenly across healthy servers
- Prevents overload by ensuring no single server handles too many requests
- Improves availability by routing around failed servers
- Enables seamless scaling by adding/removing servers without changing client configuration
How It Connects to What You Know
Remember horizontal scaling and stateless services? Load balancers are what make horizontal scaling practical. With stateless services, any server can handle any request, allowing the load balancer to freely distribute traffic for optimal performance.
Load balancers also address the single point of failure problem you saw with vertical scaling—if one server fails, the load balancer redirects traffic to healthy servers.
Key Takeaway: A load balancer is the traffic director that makes horizontal scaling work by distributing requests across multiple servers, improving both performance and reliability.