| Users | Requests per Second (RPS) | Load Balancer Role | Server Count |
|---|---|---|---|
| 100 | 50 | Single server, no load balancer needed | 1 |
| 10,000 | 5,000 | Single load balancer distributes traffic to few servers | 2-4 |
| 1,000,000 | 500,000 | Multiple load balancers with health checks and failover | 100+ |
| 100,000,000 | 50,000,000 | Global load balancers, geo-distribution, CDN integration | Thousands |
Why load balancers distribute traffic in HLD - Scalability Evidence
At low traffic, one server can handle all requests. As users grow, a single server hits CPU and memory limits first. Without a load balancer, traffic cannot be split, causing slow responses or crashes.
Load balancers prevent this by spreading requests evenly, avoiding overload on any one server.
- Horizontal Scaling: Add more servers behind the load balancer to share traffic.
- Health Checks: Load balancers detect unhealthy servers and stop sending traffic to them.
- Session Persistence: Keep user sessions on the same server if needed.
- Global Load Balancing: Use multiple load balancers across regions for geo-distribution.
- Integration with CDN: Offload static content to CDN, reducing load on servers.
Assuming 1 server handles ~3000 RPS:
- At 10,000 RPS, need ~4 servers.
- At 500,000 RPS, need ~170 servers.
- Load balancer can handle ~10,000 concurrent connections per instance.
- Network bandwidth: 1 Gbps = 125 MB/s, so servers and load balancers must have sufficient network capacity.
Start by explaining the problem of single server limits. Then introduce load balancers as a solution to distribute traffic. Discuss how load balancers improve availability and fault tolerance. Finally, mention scaling strategies and monitoring.
Your database handles 1000 QPS. Traffic grows 10x. What do you do first?
Answer: Introduce load balancers to distribute traffic across multiple database replicas or application servers to avoid overload and maintain performance.
Practice
Solution
Step 1: Understand server overload
When too many requests go to one server, it slows down or crashes.Step 2: Role of load balancers
Load balancers spread requests evenly to keep servers healthy and fast.Final Answer:
To prevent any single server from becoming overloaded and improve system reliability -> Option AQuick Check:
Load balancers prevent overload = C [OK]
- Thinking load balancers reduce total requests
- Believing load balancers slow down responses
- Assuming load balancers increase server count unnecessarily
Solution
Step 1: Identify load balancing methods
Common methods include round-robin and least connections.Step 2: Match options to known methods
Round-robin cycles through servers evenly; others are unrelated algorithms.Final Answer:
Round-robin -> Option DQuick Check:
Round-robin is a load balancing method = D [OK]
- Confusing sorting/search algorithms with load balancing
- Choosing unrelated computer science terms
- Ignoring common load balancing strategies
Solution
Step 1: Understand least connections strategy
It sends new requests to the server with fewer active connections.Step 2: Compare active connections
Server A has 3, Server B has 1, so Server B has fewer connections.Final Answer:
Server B -> Option AQuick Check:
Least connections picks server with fewer connections = B [OK]
- Choosing server with more connections
- Assuming equal distribution regardless of load
- Thinking new servers are automatically chosen
Solution
Step 1: Understand round-robin behavior
Round-robin cycles through servers in order to balance load.Step 2: Identify cause of repeated server selection
If it always picks the same server, it likely lost track of which server was last used.Final Answer:
The load balancer is not tracking the last server used correctly -> Option BQuick Check:
Round-robin needs correct tracking = A [OK]
- Blaming server downtime without checking load balancer
- Assuming network speed affects server choice
- Thinking low request volume causes imbalance
Solution
Step 1: Identify problem with round-robin
Round-robin sends equal requests regardless of server speed, causing slow server overload.Step 2: Choose better strategy
Least connections sends requests to less busy servers, reducing load on slow server.Final Answer:
Switch from round-robin to least connections to avoid slow server overload -> Option CQuick Check:
Least connections adapts to server speed = A [OK]
- Adding servers without fixing load distribution
- Increasing requests worsens overload
- Disabling load balancer causes single point failure
Ready to prove it?
Pass the test and this pattern moves unknown
