Data & storage / 8 / 11
CAP: when the link breaks
A seat-booking service runs in two data centres that copy changes to each other. When the link between them breaks, each side must choose: refuse writes and stay correct, or accept them and sort out conflicts later. How quorums make that choice automatic.
- 14 min
- Advanced
- 10 steps
- Writes accepted
- 100 %
- Stale reads
- 0 %
- Unresolved conflicts
- 0 /h
- Replication lag
- 30 ms
- request
- reply
- redelivery
- duplicate
- lost
Numbers are a model scenario, not measurements
The real request
DB east → DB westRequest
REPLICATE dc-east -> dc-west
{
"key": 1"seat:14A",
"holder": "u_42",
"version": 217,
"lag_ms": 330
}
key— The record that changed: seat 14A.version— Grows by one on every change. Replicas compare it to see which copy is newer.lag_ms— How far the copy is behind the original. Normally tens of milliseconds.
Course: 42 lessons
01 Foundations
02 Scaling
03 Data & storage
04 Communication
05 Reliability
06 Architecture
07 Security
08 Shipping
09 Whole systems
10 Business processes