Skip to content
We areTOP 1%

What are the common load-balancing algorithms, and when would you use each?

MediumConceptLoad Balancing
Track your progress
First attempt
Re-solve after a few days
Final pass before interviews

Answer

Load-balancing algorithms are either static, ignoring current server load, or dynamic, using live metrics. The right choice depends on whether servers and requests are uniform.

  • Round robin: sends requests to servers in turn; works well when servers are identical and requests cost about the same. Weighted round robin gives more powerful servers a larger share.
  • Least connections: picks the server with the fewest active connections; better for long-lived or uneven requests such as WebSockets.
  • Least response time: considers measured latency as well as load.
  • Hash-based (client IP or request key): sends the same client or key to the same server, which helps session affinity and cache locality but can create hot spots.
  • Power of two choices: samples two servers at random and picks the less loaded one.

More in Load Balancing

Sign in to track your progress

Your checkboxes, streak and activity heatmap are saved to your account and sync across devices. It is free.
Sign in with email

New here? Create an account