package consistent

Consistent hashing is often used to distribute requests to a changing set of servers. For example,
say you have some cache servers cacheA, cacheB, and cacheC. You want to decide which cache server
to use to look up information on a user.

You could use a typical hash table and hash the user id
to one of cacheA, cacheB, or cacheC. But with a typical hash table, if you add or remove a server,
almost all keys will get remapped to different results, which basically could bring your service
to a grinding halt while the caches get rebuilt.

With a consistent hash, adding or removing a server drastically reduces the number of keys that
get remapped.