flâneur — a map of the web's best reading

What Is Consistent Hashing? - by NK

newsletter.systemdesign.one · saved by 1 readers

A simple solution is to replicate the cache server. Yet only a limited amount of data set can be cached. So cache server must be partitioned to store more data. But partitioning the cache to handle dynamic load is a difficult problem. A naive approach is Static Hash Partitioning. Here’s how it works: Hash the data key Do a modulo operation of the generated hash code against the number of cache servers. This finds you the cache server ID Store data key in the cache server But existing mapping between data keys and cache servers will break if a cache server fails. Also installing an extra cache server to handle more load will break the mapping. A workaround is to rehash the data keys. But it’s an expensive operation. So static hash partitioning won’t handle a dynamic load without service degradation. A simple solution to this problem is consistent hashing. Want to become a better software engineer? Each week, Milan sends one piece of practical advice about .NET and software architecture.

A simple solution is to replicate the cache server. Yet only a limited amount of data set can be cached. So cache server must be partitioned to store more data. But partitioning the cache to handle dynamic load is a difficult problem. A naive approach is Static Hash Partitioning. Here’s how it works: Hash the data key Do a modulo operation of the generated hash code against the number of cache servers. This finds you the cache server ID Store data key in the cache server But existing mapping between data keys and cache servers will break if a cache server fails. Also installing an extra cache

Explore this link on the map →