Interview Prep/Networking/Load Balancers, Proxies & CDNs

How does consistent hashing help in load balancing and caching?

AdvancedConceptLoad Balancers, Proxies & CDNs
Answer

It maps keys and nodes onto a ring so adding or removing a node only remaps about 1/N of keys, instead of nearly all with modulo hashing. Useful for cache tiers, sharded backends and session affinity with minimal disruption.

HAProxy balance hash with hash-type consistent, nginx hash $request_uri consistent;, Envoy ring hash or Maglev.

All Networking questions Roadmap: Networking for DevOps

More on Load Balancers, Proxies & CDNs