Load balancer
A service that spreads incoming traffic across several servers, and stops sending traffic to any that fail their health checks.
Last updated
What it is.
Users connect to the load balancer, not to a server. It picks a healthy server for each request, using rules such as round robin or least connections, and checks each server regularly. If one stops answering, traffic goes to the others.
Some load balancers work at the network level and pass connections through. Others work at the HTTP level and can route by path or host name, handle HTTPS and add headers.
Why it matters
A load balancer is what lets you run more than one server, which is the base for autoscaling, zero-downtime releases and surviving a server failure. Without one, a single server is a single point of failure.
In a product build
We put a managed load balancer in front of app servers from the first production deploy, give each service a real health check that tests its dependencies lightly, and use it to drain traffic before releases.
Common mistakes.
- 01
Health checks that always pass, so broken servers still get traffic.
- 02
Keeping user sessions in server memory, so users get logged out when they hit another server.
- 03
A single load balancer in one zone, which moves the single point of failure rather than removing it.
Related terms.
- AutoscalingAutomatically adding or removing computing capacity, such as servers or containers, as the load on a system goes up or down.
- API gatewayA single entry point that sits in front of a system's APIs and handles routing, auth and limits for every request.
- Blue-green deploymentA release method that runs two identical production environments and switches all traffic from the old one to the new one in one step.
- CDN (content delivery network)A network of servers around the world that keeps copies of your files close to users, so pages and media load faster.
- Kubernetes (K8s)An open source platform that runs and manages containers across a group of machines: starting them, restarting them, scaling them and routing traffic to them.
Guides and pages
Browse the full glossary or read answers to common questions.