A load balancer spreads traffic across interchangeable, stateless app servers so any instance can serve any request and failed nodes drop out cleanly.
Key ideas
- Keep app servers stateless — put session/user state in a shared store or a signed token, never on one instance.
- Use health checks so the balancer stops routing to unhealthy nodes.
- L4 (transport) load balancing is fast and protocol-agnostic; L7 (application) routing can read paths/headers for smarter decisions.
Compare
| Layer | What it sees |
|---|---|
| L4 | IP/port — fast, no app awareness |
| L7 | HTTP path/headers — content-based routing, TLS termination |
Tip
Statelessness is what makes horizontal scaling and zero-downtime deploys possible.