tezvyn:

Cloud Load Balancer: Your App's Traffic Cop

AI-drafted, machine-checkedSource: Wikipedia: Cloud load balancingintermediate

A cloud load balancer is a traffic cop for your servers, distributing requests across a pool of machines to prevent overload. It's essential for scaling apps and ensuring high availability.

WHY IT EXISTS: A single server has finite capacity and is a single point of failure. To build a scalable and resilient application, you need to run multiple copies of your service on different machines. A load balancer solves the problem of how to efficiently and automatically distribute user traffic among them.

THE MENTAL MODEL: Think of a cloud load balancer as a smart traffic cop for your server farm. It's the single public entry point for all incoming requests. Instead of users hitting your servers directly, they hit the load balancer, which then intelligently forwards them to one of many available, healthy servers in the background.

HOW IT WORKS: A load balancer maintains a list of backend servers. When a request arrives, it applies a routing algorithm to select one. Common algorithms include Round Robin (sending requests to servers in a simple loop) or Least Connections (sending to the server with the fewest active connections). Crucially, it constantly runs health checks on the servers, automatically removing unresponsive ones from the pool and adding them back when they recover.

WHEN TO USE IT: Use a cloud load balancer for any production web application or service that needs to handle significant traffic or requires high availability. It's fundamental for auto-scaling, where new servers are added or removed based on load, and the load balancer seamlessly adjusts traffic flow.

WHEN NOT TO USE IT: For very small projects, internal tools, or development environments where a single server is sufficient and uptime is not critical, the added complexity and cost of a managed load balancer might be unnecessary.

ONE CANONICAL EXAMPLE: An AWS Application Load Balancer (ALB) sits in front of an Auto Scaling Group of EC2 instances. As user traffic increases, the Auto Scaling Group launches new instances. The ALB automatically detects these new instances, passes its health checks, and begins routing a share of the incoming HTTP requests to them, scaling the application's capacity without manual intervention.

Read the original → en.wikipedia.org

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.