/ System Design / Load Balancer ← All Designs
⚖️

Load Balancer

Distributing traffic across multiple servers to prevent overload

High Availability Scalability Fault Tolerance Traffic Management
Live Traffic Simulation ● Stopped
💻
Client 1
📱
Client 2
🖥️
Client 3
↓ ↓ ↓
Load Balancer
Round Robin
0
total requests
↙ ↓ ↘
0
Total Requests
3
Online Servers
0
Rejected
Request Distribution
⚡ Round Robin

Requests are distributed equally in sequence: S1→S2→S3→S1... Simple and predictable with no state to maintain.

✓ Equal distribution ✓ Simple implementation ✗ Ignores server load ✗ Not optimal for varying request durations

Key Concepts

🎯 When to Use
  • Traffic exceeds single server capacity
  • Need zero-downtime deployments
  • Geographic load distribution
  • Protecting against single point of failure
⚖️ Trade-offs
  • Adds network hop latency (~1-2ms)
  • LB itself can become a bottleneck
  • Stateful apps need sticky sessions
  • Health checks add overhead
🎓 Interview Tips
  • Layer 4 (TCP) vs Layer 7 (HTTP) LB
  • Always mention health checks
  • Discuss sticky session trade-offs
  • Active-active vs active-passive HA