Consistent hashing is a distributed hashing algorithm that maps keys to nodes in a cluster using a hash ring, minimizing the number of keys that must be remapped when nodes are added or removed. Unlike traditional modulo-based hashing, which requires remapping nearly all keys on a topology change, consistent hashing ensures only the keys adjacent to the changed node on the ring are reassigned. This property is critical for scalable, stateful systems like distributed caches (e.g., Memcached, Redis Cluster) and database sharding, where it provides horizontal scalability and reduces operational disruption during node failures or scaling events.
