map / distributed-systems / replication-quorums
Distributed Systems · principle 3 of 6
Replication & quorums
If every read quorum overlaps every write quorum (R + W > N), a read is guaranteed to see the latest acknowledged write.
01 · Why it’s true
Keeping N copies of data protects against losing machines, but the copies can disagree while an update is spreading. A quorum system makes every write wait for W copies to confirm, and every read ask R copies.
If R + W > N, any set of copies you read from must overlap with any set that took the latest write, so at least one copy you read has it. With N = 3, W = 2 and R = 2 overlap in at least one copy — and the system tolerates one copy being down for both reads and writes.
02 · Picture it
03 · In the interview
- Choosing N, R, and W for a datastore, and explaining the trade-offs.
- Explaining how many failures the system tolerates for reads versus writes.
- Comparing synchronous and asynchronous replication: durability versus write latency.
04 · Practice question
“You have 3 replicas. How do you configure reads and writes so a read always sees the latest successful write, and how many failures can you survive?”
A strong answer covers
- Pick R + W > N: for N = 3, W = 2 and R = 2.
- Any two read replicas share at least one with any two write replicas, so the read includes the newest value (pick it by version or timestamp).
- With W = 2 and R = 2, both reads and writes still work with one replica down.
- Alternatives: W = 3, R = 1 for fast reads but writes that stop if any replica is down; W = 1 for fast writes but possibly stale reads.