DevOps
Load Balancing
Distributes incoming traffic across multiple instances so none is overwhelmed, using strategies like round-robin, least-connections or hashing, with health checks to route around failures. It is the basis of horizontal scaling and high availability. Sticky sessions or a shared session store are needed when state lives on individual nodes.
Purpose
A load balancer distributes incoming requests across multiple instances so no single one is overwhelmed and the failure of one is invisible to users. It is the enabling component of both horizontal scaling and high availability.
When to Use It
Any service running more than one instance: web tiers behind an L7 (HTTP-aware) balancer that can route by path and host, TCP services behind an L4 balancer for raw speed. Cloud offerings (ALB/NLB and peers) and software balancers (Nginx, HAProxy) cover the spectrum.
Trade-offs
Balancing assumes instances are interchangeable — in-memory session state breaks that, forcing sticky sessions (uneven load, lost sessions on instance death) or, better, externalising state to Redis or a database. Health-check tuning again decides how fast failures are routed around versus how much flapping you tolerate.
Implementation
Choose a strategy: round-robin as the default, least-connections for uneven request costs, consistent hashing when cache locality matters. Configure health checks that hit a real readiness endpoint, drain connections before removing instances during deploys, and run the balancer itself redundantly.