Load Balancing

  • Client to gateway: DNS parse domain to different ip addresses. (If we have multiple data centers, DNS will find the geographically closest data center)

  • Gateway to web server: reverse proxy

  • web server to application server: connection pool

  • database load balancing: partition / sharding

How to distribute traffic:

  • random, round-robin

  • min connection count

  • min latency

  • based on IP.

Consistent Hashing

  • Consistent Hashing is one of the ways to achieve load balancing.

  • Consistent Hashing allows requests to be mapped into hashed buckets which allowing the system to add/remove nodes flexibly so as to maintain a good load factor on each machine.

Last updated