Cianplan

Level 1: Foundations · L1.3 Load balancing, reverse proxies, API gateways

Load balancing algorithms

Compare round robin, least connections and hashing, with health checks.

12 min · Free

What you take away

  • Round robin spreads requests evenly, which only spreads load evenly when requests cost the same.
  • Least connections tracks what each server is still working on, so it adapts to uneven request cost.
  • Hashing sends the same key to the same server — needed for locality, and the source of hot instances.
  • Health checks decide who is in the pool, and a check that is too deep can remove every instance at once.

How the class is laid out

  1. The problem
  2. The simple version
  3. The algorithms
  4. Who is in the pool
  5. Check your understanding