System Design
7. Caching ArchitectureAnimated
Memcached
A simple, fast in-memory key-value cache.
The idea
Memcached stores strings by key across a pool of servers, with no persistence.
Watch it work
Press play, pause, or step through. Some animations have settings you can change.
- outlined = moved key
Nodes and keys are hashed onto the same ring. Each key belongs to the first node clockwise from it.
- nodes:
- 4
- keys:
- 30
- moved:
- 0
1/2
Dots on the ring are keys; larger circles are servers.
Step by step
- 1Client hashes the key
- 2Chooses a server
- 3Gets or sets the value
- 4Expires entries by TTL
Where it is used
Simple caching.
Watch out for
No persistence or rich types.