Sharding · Flashcard

Why use consistent hashing instead of hash(key) % N to pick a shard?

medium Caching

Answer

With % N, adding or removing one server changes N and remaps almost every key. With consistent hashing, only about 1/N of the keys move, those between the new server and its neighbour on the ring. Virtual nodes spread the load evenly.

Review this in your daily deck All cards in Sharding