


A load balancer is a form of reverse proxy: it accepts client requests on behalf of backend servers and forwards those requests. When you hear “reverse proxy,” picture the load balancer routing traffic to healthy backend app instances.

/health endpoint). If server 3 stops responding, the load balancer marks it unhealthy and removes it from rotation. The remaining servers pick up the extra traffic and users typically do not notice dropped requests.
Request path (summary):
- Client asks DNS for
photoapp.com. - DNS returns the load balancer’s IP.
- The load balancer selects a healthy backend server.
- The selected server handles the request (DB access, computing, etc.).
- The response returns through the load balancer to the client.
- Round robin: cycles through servers sequentially (1, 2, 3, 1, …). Simple and effective for uniform workloads.

- Least-connections: routes the next request to the server with the fewest active connections. Useful when requests have wide variance in duration; the balancer maintains counters of open connections per backend.

- Weighted distribution: assign higher weights to more powerful servers so they receive proportionally more requests.
Most teams don’t implement load balancers from scratch. Common open-source reverse proxies such as NGINX and HAProxy run on machines you manage. Cloud providers offer managed options like AWS Elastic Load Balancing, which simplify operations and handle many edge cases.

A single load balancer can become a single point of failure: if it dies, all backends become unreachable. Production systems use multiple load balancers for redundancy.
keepalived, or cloud-managed multi-AZ load balancing. How you implement failover depends on your infrastructure and availability requirements.

- DNS basics: https://learn.kodekloud.com/user/courses/demystifying-dns
- NGINX: https://learn.kodekloud.com/user/courses/nginx-for-beginners
- HAProxy: https://www.haproxy.org/
- AWS Elastic Load Balancing: https://learn.kodekloud.com/user/courses/aws-networking-fundamentals
- Anycast: https://en.wikipedia.org/wiki/Anycast
- keepalived: https://www.keepalived.org/