System Design · Senior · Question 4 of 75

Why use consistent hashing when adding cache nodes?

Explanation

With hash(key) % N, changing N redistributes almost all keys and the cache misses en masse. A hash ring (with virtual nodes) moves only ~1/N of the keys. Used in distributed caches, CDNs and databases.

Further reading

Problem with a question

System Design · Senior · question 4

Test yourself

Take the System Design · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz