Free preview

Leaderless Replication and Quorums

In one line: this is the model behind Dynamo-style systems, and the quorum inequality it rests on is one of the few pieces of distributed-systems math worth being able to derive on a whiteboard.

The model

Every node reads and writes all the data, and nodes communicate their writes to each other. There is no leader to fail, no failover to perform, and no election to get wrong.

Like multi-leader systems, leaderless replication allows concurrent writes, which can lead to inconsistency. The mechanism for managing that is quorums.

Quorums

Quorums ensure data consistency by requiring a minimum number of votes for operations to succeed. In a cluster of n nodes:

  • w — the minimum number of nodes that must acknowledge a write.
  • r — the minimum number of nodes queried for a read.

To guarantee strong consistency — reading the latest write — you must satisfy:

r + w > n

The reasoning is a counting argument. With n = 3, a write lands on 2 nodes and a read queries 2 nodes. Since 2 + 2 = 4 > 3, the two sets cannot be disjoint — they must share at least one node, and that shared node has the newest write. Violate the inequality and a read can land entirely on stale replicas.

These values are configurable in Dynamo-style databases, which is the real appeal: you tune consistency, latency, and availability per operation rather than per system.

Config (n/r/w)Legal?ReadsWritesBest for
3 / 2 / 1✗ — 2+1 is not > 3——Rejected: quorums can miss each other
3 / 2 / 2BalancedBalancedGeneral-purpose default
3 / 1 / 3Fast — any nodeSlow — all three syncRead-heavy, write-rare data
3 / 3 / 1Slow — all threeFast — one nodeWrite-heavy, always-accept-the-write

Read the extremes as design intents

Low w is the always accept the write posture — a shopping cart that must never reject an add-to-cart, even during trouble. The cost is that reads must query more nodes to be sure they see it.

Low r is the always answer fast posture — any replica responds instantly, but every write must reach all n synchronously, so writes are slow and less available.

r + w > n fixes a budget. You spend it on read freshness or write speed; you cannot minimize both.

Where leaderless fits

ModelWrite scalabilityFailover complexityConflict handlingConsistency
Single-leaderLimited — one writerElection plus fencing neededNone — leader serializesStrong on the leader
Multi-leaderBetter — several writersModerateRequired — avoidance, LWW, or mergeEventual
LeaderlessBest — every node writesNone — no leader to loseRequired — versioning plus quorumsTunable via r and w

The distinguishing property is the middle column. Leaderless has no failover story at all, because there is nothing to fail over — which removes the split-brain risk that makes single-leader automatic failover genuinely difficult.

Quorums don't remove conflicts, they bound staleness

r + w > n guarantees a read sees the latest write. It does not decide what happens when two clients write concurrently to different nodes — both writes are accepted, and the read returns divergent versions.

Dynamo-style systems resolve that with version vectors, returning the conflicting versions for the client to reconcile and writing the merged result back. That is the same conflict problem from the multi-leader lesson, handled at read time instead of write time. The Key-Value Store chapter works this mechanism in depth.

Key takeaway

Leaderless trades a leader's simplicity for no single point of write failure and per-operation tunability. r + w > n is the invariant that makes it safe, and the numbers you choose are a statement about which you value more: fresh reads or fast writes.

Interview signal by level

LevelWhat a strong answer sounds like
L4"In a leaderless system any node can take reads and writes."
L5Knows the rule: "quorums with r + w > n so read and write sets overlap and the read sees the latest write."
Staff+Derives and tunes it: "the overlap is a counting argument — with n=3, w=2 and r=2 can't be disjoint. I'd run w=1 for the cart so writes are never rejected, and pay for it with r=3 there. And quorum latency is the slowest node in the set, not the average."

Next: what happens when the data no longer fits on one node.

Enjoying the preview?

Create a free account to unlock the rest of this course, the in-browser judge, and live AI mock interviews.

Sign up free to continue