Q34: What is consistent hashing, and where is it useful?

Difficulty:AdvancedTopic:Distributed Systems

Consistent hashing maps keys and nodes onto a logical ring so each key is assigned to a nearby node. Adding or removing a node remaps only a portion of keys rather than nearly all keys, unlike simple modulo hashing. Virtual nodes improve distribution. It is useful for cache clusters and partition assignment, but it does not by itself solve replication, rebalancing, hot keys, or data migration.

Key Takeaways
  • Consistent hashing reduces remapping when membership changes.
  • Use virtual nodes and separately plan replication and migration.