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

R1R2R3R4R5write waits for W = 3read asks R = 3has the newest writeN = 5 replicas. R + W = 6 > 5, so every read set shares at least one replica with everywrite set — that replica has the newest value.
R1R2R3R4R5write: W = 3read: R = 3overlapN = 5 replicas. R + W = 6 > 5, soevery read set shares at least onereplica with every write set — thatreplica has the newest value.
If R + W > N, every read overlaps the latest write.

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

  1. Pick R + W > N: for N = 3, W = 2 and R = 2.
  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).
  3. With W = 2 and R = 2, both reads and writes still work with one replica down.
  4. 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.