Performance & Scalability interview question · Most asked
How do load balancers work, and what algorithms do they use?
Summary
Load balancers distribute requests across healthy backends using algorithms like round robin, least connections, weighted, or consistent hashing (for affinity), and remove unhealthy instances using health checks. L4 balancers route TCP/UDP connections; L7 balancers understand HTTP and can route by path, header or host.
Longer Answer
L7 features: TLS termination, path-based routing, retries, sticky sessions (avoid when possible), request buffering. Global load balancing (DNS/anycast) routes users to the nearest region.
Key Points
- Round robin / least connections / hashing
- Health checks
- L4 vs L7
- Avoid sticky sessions
- Global LB for regions
More most-asked Performance & Scalability questions
- What is the difference between vertical and horizontal scaling?
- What's the difference between latency and throughput?
- How do you approach a performance problem methodically?
- Why are timeouts, retries and circuit breakers essential for performance and reliability?
- What are the most common database-related performance problems?