Amazon's ElastiCache team uses consistent hashing to distribute cache keys across Redis nodes. The classic problem: with regular modular hashing (key % N), adding a new server remaps ~83% of keys, causing a massive cache stampede. Consistent hashing reduces remapping to ~1/N of keys. This is how DynamoDB, Cassandra, and Riak distribute data.
Building a distributed Redis cache. When a node is added, map user IDs to servers using Consistent Hashing so only 1/N of keys need remapping. Implement the lookup algorithm.
βΆ Run Code to test against examples Β· Submit to judge all 5 test cases