Load Balancing - Algorithms (Round Robin, Least Connections, IP Hash)
Imagine a popular e-commerce website during a big sale event where thousands of users simultaneously request product pages. Efficiently distributing these requests to multiple servers ensures smooth user experience without any server overload.
Explain the common load balancing algorithms: Round Robin, Least Connections, and IP Hash. How do they differ, and what are their typical use cases and trade-offs?
Load balancing purpose and benefitsRound Robin, Least Connections, and IP Hash algorithmsSession persistence (sticky sessions) and health checks- What happens if all backend servers have the same number of active connections in Least Connections?
- How does IP Hash handle users behind NAT or proxy servers sharing the same IP?
- What if a server goes down during a session in IP Hash or Round Robin?
- How does Round Robin behave when servers have different capacities or performance?
Interviewer thinks candidate lacks understanding of load-aware balancing
✅ Clarify that Round Robin distributes requests evenly without considering server load or capacity
Interviewer doubts candidate's grasp of session affinity limitations
✅ Explain IP Hash can fail with clients behind NAT or proxy sharing IPs and does not handle server failures gracefully
Interviewer sees incomplete understanding of production readiness
✅ Mention health checks as essential for detecting and removing unhealthy servers from rotation
Interviewer questions candidate's knowledge of dynamic load balancing
✅ Highlight that Least Connections routes based on current active connections, unlike Round Robin's fixed order
