educative.io

Consistent hashing

  1. What if a word becomes hot? Then there will be a lot of queries on the server holding that word. This high load will affect the performance of our service.
  2. Over time, some words can end up storing a lot of TweetIDs compared to others, therefore, maintaining a uniform distribution of words while tweets are growing is quite tricky.

how does consistent hashing help us recover from above. even with consistent hashing, a very popular word will always be mapped to the same partition. also, it won’t prevent words the have a lot of tweet ids to keep getting more tweet ids.

Hi @Dewey_Munoz

In consistent hashing, mainly, the virtual nodes concept is applicable in the above scenario. The above situation poses a problem of rescaling nodes in a server, and hence handling it using the virtual nodes – several token ranges get mapped to a physical node instead of a single token range – solves the problem of a node becoming a hotspot.