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.
More on Load Balancers, Proxies & CDNs
What is a load balancer and why do we use one?BeginnerWhat is the difference between L4 and L7 load balancing?IntermediateCompare ALB, NLB, GWLB and Classic Load Balancer in AWS.IntermediateWhat load-balancing algorithms are common?BeginnerWhat are health checks and how should they be designed?AdvancedWhat is connection draining (deregistration delay)?Intermediate