Distributed Cache
A standalone in-memory key-value cache: clients hash straight to the owning node, leaders replicate asynchronously, and one hot key or one dead node never takes the cache down.
- Memory: 1 TB of cached data
- Traffic: 100,000 RPS · sub-10 ms
- Fleet: 50 primary nodes · 24 GB usable of 32 GB
- Per node: saturates at ~20,000 RPS
- Eviction: starts at 85% memory
- Hot key: one key at 100,000 reads/sec
Client library
The application-side library. It hashes every key with MurmurHash onto the ring, looks up the owning node from its copy of the ring map, and talks to that node directly over a pooled connection.
Config plane
The central dynamic config that records which node owns which ring range and which node leads each range. Clients and nodes watch it; it is never on the per-request path.
Consistent-hash ring
Maps every key to the node that owns its range. Nodes own arcs of the MurmurHash ring, so adding or removing a node moves only that node's keys.
Cache node (leader)
Owns a key range. A per-node hash table plus a doubly-linked list gives O(1) get, put and LRU eviction; TTLs expire passively on read and the janitor sweeps the rest. 50 of these hold the 1 TB.
Replicas
Copies of the leader's range. They receive the leader's updates asynchronously and one of them is promoted if the leader dies.
Janitor thread
An asynchronous background thread on each node that walks the keyspace and removes keys whose TTL passed, including keys nobody reads again.
Singleflight
Request coalescing on the read path: concurrent reads for the same missing key collapse into one fetch while the others wait. Stale-while-revalidate serves the old value during the refresh.
Hot-key copies
When one key receives 100,000 reads/sec, random suffixed copies (key#0, key#1, ...) spread it across nodes; readers pick a suffix at random. Writes to the hot key are batched.
Failure handling
Watches node heartbeats; when a leader stops responding it promotes a replica for that range and updates the config plane so clients re-route.