Notesreplication🌱 seedling
Quorum
Also: Quorum Reads and Writes · Read Quorum · Write Quorum · w + r > n
With n replicas, require w acknowledgements per write and r responses per read. If w + r > n, every read set overlaps every write set in at least one replica, so some reply carries the latest successful write.
Why it exists
It lets a replicated store tolerate unavailable replicas without a leader, while still giving reads a good chance of seeing recent writes.
How it works
- Pure counting: w + r replicas can't fit into n without sharing one when w + r > n.
- Common: n = 3, w = 2, r = 2 (tolerates one down replica for both reads and writes). Majority quorums are w = r = ⌊n/2⌋ + 1.
- w = n, r = 1 favours reads; one dead replica blocks writes. w or r below quorum trades freshness for latency and availability.
Trade-offs
| Setting | Gains | Costs |
|---|---|---|
| w + r > n | likely-fresh reads | latency of the w-th / r-th fastest replica |
| w + r ≤ n | lower latency, more availability | stale reads are expected |
In practice
- Dynamo commonly ran (n, w, r) = (3, 2, 2). Cassandra maps it to consistency levels such as
QUORUMandLOCAL_QUORUM(majority within one datacentre).
Pitfalls
Quorums are not linearizable. Stale reads still happen when:
- concurrent writes are resolved by Last Write Wins;
- a write failed (fewer than w acks) but wasn't rolled back where it landed;
- a read overlaps an in-flight write;
- a replica is restored from a stale copy;
- a Sloppy Quorum put the write outside the home replicas.
Connections
Recall
These cards are also in your review deck, scheduled with spaced repetition.