System Design
6. Distributed Systems FundamentalsAnimated
CAP Theorem
During a partition, choose consistency or availability.
The idea
When the network splits, a system must either refuse some requests (consistent) or answer with possibly stale data (available).
Watch it work
Press play, pause, or step through. Some animations have settings you can change.
- client
- gateway / proxy
- service
- cache
- data store
- queue / stream
Independent machines coordinate only by passing messages.
- step:
- 1/4
- at:
- Node 1
1/8
The green dot is a request moving through the system.
Step by step
- 1Network partition happens
- 2CP: reject writes on the minority side
- 3AP: accept writes on both sides
- 4Reconcile after healing
Where it is used
Choosing database behaviour.
Watch out for
CAP is about partitions only. Day-to-day, latency vs consistency matters (PACELC).