Distributed Caching: Memcached, Hashing & Hot Keys
When one Redis instance is not enough, you scale horizontally. Consistent hashing maps cache keys to nodes in a ring — when you add or remove a node, only a fraction of keys need to move, not the entire dataset. Redis Cluster implements this natively with 16,384 hash slots distributed across nodes. Memcached is Redis's simpler cousin: pure key-value, no persistence, no data structures, multi-threaded. Choose Memcached when you need a dumb, fast, large cache with no durability requirements. Choose Redis when you need data structures, persistence, pub/sub, or atomic operations. The hot key problem occurs when a single key (celebrity profile, breaking news article) receives disproportionate traffic, overwhelming one cache node. Solutions: local in-process caching of hot keys (L1), read replicas for that key, or splitting the key into multiple sub-keys (hot:article:123:shard-1 through shard-N) and aggregating on read.