Quorums & Sloppy Quorums: N, W, R and What the Overlap Really Buys You
It is 02:10 and a shopping cart service running on a three-replica, leaderless key-value store starts returning carts with items missing. Nothing is down. The dashboards show every replica healthy, p99 at 9 ms, and the error rate at zero. The team had configured writes and reads at consistency level ONE because “it is faster”, and a replica that was rebooted for a kernel patch 40 minutes earlier is still catching up.
A customer adds a phone to the cart. The write lands on replica A and returns. The next page load reads from replica C, which never saw it. The phone vanishes. The customer adds it again, and now replica B gets a second copy with a different timestamp. Support gets 300 tickets before anyone looks at the consistency settings.
The fix was one line: write with 2 acknowledgements, read from 2 replicas. That one line is quorum math, and this article is about what it does guarantee, what it quietly does not, and how to size quorums when your replicas live in different availability zones and regions.
What it is
A quorum system is a rule that says how many replicas must take part in an operation before it counts. With N copies of each item, a write succeeds when W replicas acknowledge it and a read collects responses from R replicas.
The central rule is the overlap rule: if W + R > N, every read set shares at least one replica with every successful write set, so a read always contacts at least one replica that has the latest acknowledged write. If you also choose W > N/2, any two write sets overlap, so two writes can never both succeed on disjoint halves of the cluster.
Quorums appear in two quite different families of systems. Leaderless stores in the Dynamo tradition (Apache Cassandra, ScyllaDB) expose N, W and R to the client. Leader-based consensus systems such as Raft and Paxos use majority quorums internally, which is covered in distributed consensus. The math is the same; what the system does with the overlap is very different. If you need a refresher on why leaderless replication exists at all, see replication strategies.
How it works
The overlap rule, with proof intuition
Think of the N replicas as N chairs. A write puts a sticker on W chairs. A read sits in R chairs. If the read could avoid every sticker, then the sticker chairs and the read chairs would be disjoint, so together they would need W + R distinct chairs. There are only N. So when W + R > N, avoiding the sticker is impossible. That is the whole proof: the pigeonhole principle.
flowchart LR subgraph N3["N = 3 replicas"] A["Replica A<br/>v2"] B["Replica B<br/>v2"] C["Replica C<br/>v1 (stale)"] end W["Write v2<br/>W = 2 acks"] --> A W --> B R["Read<br/>R = 2 replies"] --> B R --> C B -->|"overlap: newest timestamp wins"| OUT["Client sees v2"] style A fill:#E1F5EE,stroke:#0F6E56,color:#085041 style B fill:#EEEDFE,stroke:#534AB7,color:#3C3489 style C fill:#FAEEDA,stroke:#854F0B,color:#633806 style OUT fill:#E1F5EE,stroke:#0F6E56,color:#085041
The read gets two answers, v2 from B and v1 from C, and needs a way to know v2 is newer. That is the job of a version: a timestamp, a version number, or a vector of versions (see time, clocks and ordering). Overlap guarantees the newest value is in the reply set. The version tells you which reply it is.
The second rule, W > N/2, is about writes against writes. With N = 5 and W = 2, two clients can write different values to replicas 1-2 and 4-5 at the same time, both succeed, and no replica saw both. You now have a conflict that must be resolved later. With W = 3, any two write sets share a replica, which is what lets a system detect or order the conflict.
Failures tolerated
The availability side of the trade is simple subtraction:
| Setting (N, W, R) | Overlap? | Write survives | Read survives | Typical use |
|---|---|---|---|---|
| 3, 2, 2 | yes (4 > 3) | 1 replica down | 1 replica down | balanced default |
| 3, 3, 1 | yes (4 > 3) | 0 down | 2 down | read-heavy, rare writes |
| 3, 1, 3 | yes (4 > 3) | 2 down | 0 down | write-heavy logging |
| 3, 1, 1 | no (2 is not more than 3) | 2 down | 2 down | caches, metrics |
| 5, 3, 3 | yes (6 > 5) | 2 down | 2 down | higher durability |
Writes tolerate N - W failures and reads tolerate N - R. Every unit you add to W you take from write availability; every unit you add to R you take from read availability and add to read latency, because the read waits for the R-th fastest replica, not the fastest one.
Try it. Start at the 3/2/2 preset, then drop R to 1 and watch the read set miss the write. Then try 5/2/2 and notice that the cluster is bigger yet less consistent.
Latency is an order statistic
A quorum operation sends to all N replicas (or at least W or R of them) and returns when the W-th or R-th reply arrives. If replica latencies are 2 ms, 3 ms and 40 ms (one replica is in a GC pause), W = 2 returns in 3 ms, while W = 3 returns in 40 ms. Quorums are a cheap form of tail-latency protection: you ignore the slowest N - W replicas. This is the same effect described in latency vs throughput.
What quorums do not give you
This is the most common interview mistake in this whole area: W + R > N does not make a system linearizable. Linearizability means every operation appears to take effect at one instant between its call and its return, so once any read returns v2, no later read may return v1 (see consistency models). Plain quorums break that in at least four ways.
1. Concurrent reads during an in-flight write. A write of v2 has reached replica A but not yet B or C. Reader 1 queries A and B, sees v2 on A, and returns v2. Reader 2 starts after reader 1 finishes, queries B and C, and returns v1. Time went backwards, yet both reads overlapped every completed write set.
sequenceDiagram participant W as Writer participant A as Replica A participant B as Replica B participant C as Replica C participant R1 as Reader 1 participant R2 as Reader 2 W->>A: write v2 Note over B,C: v2 still in flight R1->>A: read A-->>R1: v2 R1->>B: read B-->>R1: v1 Note over R1: returns v2 (newest) R2->>B: read B-->>R2: v1 R2->>C: read C-->>R2: v1 Note over R2: returns v1 after R1 saw v2
2. Failed writes are not rolled back. If a write with W = 2 reaches only one replica and the client gets a timeout, that value is not removed. A later read may or may not see it, and read repair may spread it to the others. A write that “failed” can later appear to have succeeded.
3. Last-write-wins with skewed clocks. If versions are wall-clock timestamps, the “newest” value is the one with the largest timestamp, not the one written last. More on this below.
4. Sloppy quorums. If the system lets writes land on stand-in nodes outside the home replica set, the overlap proof no longer applies.
What closes the gap:
- Blocking read repair with write-back. Before returning v2, reader 1 writes v2 back to a quorum and waits for acknowledgements. Now reader 2 is guaranteed to see v2. This is the core of the ABD algorithm (Attiya, Bar-Noy and Dolev), and it gives a linearizable read/write register when versions are well ordered. Cassandra 4.0 and later default to blocking read repair (table option
read_repair = 'BLOCKING'), which gives monotonic quorum reads, but its last-write-wins timestamps and unrolled failed writes still keep plain QUORUM short of linearizable. - Consensus for conditional updates. A register is not enough for “set only if the current value is X”. Compare-and-set needs consensus. Cassandra exposes this as lightweight transactions (
IF NOT EXISTS,IF col = ?), which run a Paxos round per operation and cost several extra round trips. - A leader per key range. Most strongly consistent databases avoid the problem by putting a consensus-elected leader in front of each partition, which is the subject of distributed consensus.
Sloppy quorums and hinted handoff
The 2007 Amazon Dynamo paper introduced a twist. Each key has a preference list: the N nodes that own it on a consistent hashing ring, followed by more nodes further along. If some of the N owners are unreachable, a sloppy quorum writes to the next healthy nodes on the list instead, and those stand-ins keep a hint saying “this belongs to node C”. When C comes back, the stand-in forwards the data and deletes its copy. That forwarding is hinted handoff.
flowchart LR CL["Client write<br/>key k, W = 2"] --> COORD["Coordinator"] COORD -->|"ack"| A["A (owner)"] COORD -.->|"timeout"| B["B (owner, down)"] COORD -.->|"timeout"| C["C (owner, down)"] COORD -->|"ack + hint for B"| D["D (stand-in)"] D -->|"B recovers:<br/>hinted handoff"| B style B fill:#FCEBEB,stroke:#A32D2D,color:#791F1F style C fill:#FCEBEB,stroke:#A32D2D,color:#791F1F style D fill:#FAEEDA,stroke:#854F0B,color:#633806 style A fill:#E1F5EE,stroke:#0F6E56,color:#085041
The write succeeded with W = 2 (A and D), but a read with R = 2 that goes to the owners B and C, once they are back up but before handoff runs, misses it completely. A sloppy quorum trades the overlap guarantee for write availability. That was the right trade for a shopping cart in 2007, and it is the wrong one for an account balance.
Not every Dynamo-style system works this way. In Cassandra, hints are stored and replayed, but they do not count toward the consistency level (except the special level ANY). A QUORUM write in Cassandra still needs a real quorum of owners; hints are only a repair mechanism. Keep that distinction straight: hinted handoff is a repair technique, sloppy quorum is the decision to count stand-ins as quorum members.
Hints are also bounded. If a node is down longer than the hint window (Cassandra’s max_hint_window defaults to 3 hours), hints stop being stored for it and you need a full repair.
Repair: read repair and anti-entropy
Replicas drift. Three mechanisms pull them back together.
Read repair fixes what reads touch. When a quorum read sees v2 on one replica and v1 on another, the coordinator writes v2 to the stale one. Blocking read repair waits for that write before answering the client; asynchronous read repair does it in the background. Read repair never fixes data nobody reads.
Hinted handoff fixes short outages, as above.
Anti-entropy repair fixes everything else. Replicas compare their data in bulk, and to avoid shipping terabytes they compare Merkle trees: each leaf hashes a small range of keys, each parent hashes its children, and the root summarises the whole range. Two replicas compare roots; if they match, the range is identical. If not, they recurse into only the children that differ.
There is a hard deadline on repair in Cassandra. Deletes are written as tombstones, which are purged after gc_grace_seconds (default 864,000 s, which is 10 days). If a replica missed a delete and is not repaired before the tombstone is purged elsewhere, the old value comes back to life. Repair every range within gc_grace_seconds, not “weekly when we remember”.
Last-write-wins and silent data loss
Most leaderless stores resolve conflicts with last-write-wins (LWW): every write carries a timestamp and the largest timestamp wins. Cassandra uses microsecond timestamps assigned by the client driver or the coordinator from the wall clock.
LWW is simple and it loses data whenever clocks disagree. Suppose server S1’s clock runs 150 ms ahead. At real time 10:00:00.000, S1 writes status = shipped stamped 10:00:00.150. At real time 10:00:00.100, S2 (correct clock) writes status = cancelled stamped 10:00:00.100. The cancellation happened later in real time but carries the smaller timestamp, so every replica keeps shipped. No error, no conflict log, no alert. NTP typically keeps servers within a few milliseconds, but VM migrations, leap-second handling and misconfigured hosts produce exactly this kind of skew. The fix is version vectors or causal ordering (time, clocks and ordering), or data types that merge instead of overwrite, covered in CRDTs and conflict resolution.
LWW also loses concurrent updates even with perfect clocks: two clients that each read a cart, add one item and write the whole cart back will keep only one item. Model data so writes do not clobber each other (one row per cart item instead of one blob per cart).
Quorums across zones and regions
Replica count is only half the design. Where the replicas live decides which failures a quorum actually survives.
Three availability zones, N = 3, one replica per zone. QUORUM is 2, so losing any whole zone leaves 2 replicas and both reads and writes continue. This is the standard layout, and it is why cloud regions with at least three zones matter.
Two zones, N = 3. One zone holds 2 replicas. Lose that zone and only 1 replica remains, so QUORUM fails. Two-zone deployments cannot survive the loss of the larger zone with a majority quorum. Adding a third zone, even one that only holds a witness or tiebreaker, fixes it.
Multiple regions. Cassandra lets you set a replication factor per datacenter, for example 3 in us-east and 3 in eu-west, for 6 replicas total. Then:
| Consistency level | Replicas required | Crosses the ocean? | Survives a region loss? |
|---|---|---|---|
| QUORUM | 4 of 6 total | yes, always | no (3 left is not 4) |
| LOCAL_QUORUM | 2 of 3 in the local DC | no | yes, for local clients |
| EACH_QUORUM (writes) | 2 of 3 in every DC | yes | no |
| ONE / LOCAL_ONE | 1 | no | yes |
LOCAL_QUORUM is the usual choice: single-digit millisecond latency, overlap within the region, asynchronous replication to the other region. The price is that a read in eu-west can miss a write acknowledged a moment ago in us-east. EACH_QUORUM waits for a quorum in every datacenter and is a write-only level in Apache Cassandra. Global QUORUM with 2 datacenters is the worst of both worlds: every request pays a cross-region round trip (roughly 70 to 80 ms between the US east coast and western Europe), yet losing either region still blocks it, because 3 of 6 is not a majority. If you need a global majority, use an odd number of regions, for example RF 2 + 2 + 1 across three regions, where QUORUM is 3 of 5 and any single region can fail. Region-level layout trade-offs continue in multi-region architecture.
Majority quorums are the foundation of consensus
Consensus protocols use the special case W = R = floor(N/2) + 1, the majority. Any two majorities intersect, so:
- a leader elected by a majority in term 5 must have contacted at least one node that voted in or saw term 4, and
- any entry committed by a majority is known to at least one member of every future election majority.
That is why a 5-node Raft cluster tolerates 2 failures and a 4-node one tolerates only 1 (a majority of 4 is 3). The protocol details are in distributed consensus.
Flexible quorums. In 2016, Howard, Malkhi and Spiegelman showed with Flexible Paxos (FPaxos) that Paxos does not need every quorum to be a majority. The leader-election quorum (Q1) only has to intersect the replication quorum (Q2): |Q1| + |Q2| > N. With N = 10 you could replicate each entry to Q2 = 3 nodes and require Q1 = 8 nodes for the rare leader change. Steady-state writes get faster and cheaper; leader election becomes harder to complete during failures. It is the same overlap rule, applied to two different phases.
Where it breaks
- Correlated failures. The availability math assumes independence. Three replicas on one host, rack, zone or kernel version fail together.
- Membership changes. Adding or moving replicas changes which nodes count. During a range move, reads and writes must consider both old and new owners or the overlap is lost.
- Partial writes treated as failures. Clients that retry a timed-out write can create duplicates unless the write is idempotent (see idempotency).
- Hot coordinator, slow replica. A replica that is slow but not dead keeps getting requests. With R = 2 of 3, one slow replica is ignored; with R = 3 it sets your p99.
- Reading your own writes across regions.
LOCAL_QUORUMgives no cross-region guarantee. Route a user to one home region if they must see their writes immediately.
Real-world systems
- Apache Cassandra and ScyllaDB: per-request consistency levels (ONE, QUORUM, LOCAL_QUORUM, EACH_QUORUM, ALL, SERIAL and LOCAL_SERIAL for lightweight transactions), LWW timestamps, hinted handoff, Merkle-tree repair. Hints do not count toward the consistency level.
- Amazon Dynamo (2007 paper): the origin of sloppy quorums, hinted handoff and vector-clock versions. Do not confuse it with DynamoDB, which is leader based per partition using Multi-Paxos and does not expose N, W and R.
- Raft and Paxos systems (etcd, ZooKeeper, CockroachDB, Spanner): majority quorums under a leader, which gives linearizability because the leader orders all writes.
- Apache Kafka: a related but different idea. Producers with
acks=allwait for the in-sync replica set, andmin.insync.replicassets the minimum size of that set; see Kafka internals.
How to apply it
Start with N = 3 across three zones, W = 2, R = 2. Change it only with a reason:
- Need linearizable reads or compare-and-set? Plain quorums are not enough. Use a consensus-backed store, or per-operation Paxos (Cassandra LWT) for the few operations that need it.
- Read-heavy, writes rare and can fail loudly? W = N, R = 1 is valid, but any single replica outage blocks writes.
- Write-heavy telemetry where losing a few points is fine? W = 1, R = 1 and accept staleness. Make sure repair runs.
- Multi-region?
LOCAL_QUORUMfor latency; route users to a home region for read-your-writes; use an odd number of regions if you truly need a global majority. - Conflict resolution: avoid LWW on data that users edit concurrently. Prefer per-item rows, version vectors or CRDTs.
Checklist before you ship a quorum design:
- Does every read set overlap every write set (
W + R > N)? - Do two write sets overlap (
W > N/2) if concurrent writers are possible? - Which failure domain does each replica sit in, and does losing the biggest one still leave W and R replicas?
- Are sloppy quorums enabled, and is that acceptable for this data?
- How do versions get ordered, and what happens under 100 ms of clock skew?
- Is anti-entropy repair scheduled within the tombstone grace period?
Interview angle
Interview questions
Q1: N = 3, W = 2, R = 2. Is this strongly consistent?
It guarantees that every read overlaps the most recent completed write, so a read after a write has finished will see it, assuming versions are ordered correctly. It is not linearizable on its own. A read that overlaps an in-progress write can return the new value and a subsequent read can return the old one. Failed writes are not rolled back, and LWW timestamps can pick the wrong winner under clock skew. To get linearizable single-key reads and writes, reads must write back the value they return to a quorum before returning, with totally ordered versions. For compare-and-set you need consensus, such as Cassandra lightweight transactions or a leader-based store.
Q2: Your cluster has 2 datacenters with RF 3 each. A colleague proposes QUORUM everywhere for safety. What do you say?
QUORUM needs 4 of 6 replicas, so every request waits for at least one cross-region reply, adding a full ocean round trip of around 70 to 80 ms. Worse, if either datacenter goes down only 3 replicas remain and QUORUM fails, so it is slower and less available. LOCAL_QUORUM gives overlap within each region at local latency, and the trade-off is cross-region staleness. If a global majority is truly required, add a third region so QUORUM is 3 of 5 and survives the loss of any one region.
Q3: What is the difference between a sloppy quorum and hinted handoff?
Hinted handoff is a repair mechanism: when an owner replica is down, another node stores the write with a hint and forwards it when the owner returns. A sloppy quorum is the decision to count that stand-in toward W. With a sloppy quorum the overlap guarantee breaks, because a later read from the true owners may miss the write. Cassandra uses hinted handoff but not sloppy quorums for consistency levels above ANY, while the original Dynamo design used both to keep writes available.
✅ Key takeaways
W + R > Nguarantees that a read overlaps the latest completed write;W > N/2makes concurrent writes overlap. The proof is the pigeonhole principle.- Overlap is not linearizability. You also need blocking write-back on reads with ordered versions, or consensus for conditional updates.
- Sloppy quorums count stand-in nodes toward W and give up the overlap; hinted handoff, read repair and Merkle-tree anti-entropy are how replicas converge.
- LWW silently drops writes under clock skew and concurrent read-modify-write. Model data so writes do not overwrite each other.
- Placement decides survivability: 3 zones with N = 3 survive a zone loss; global QUORUM across 2 regions survives neither latency nor a region loss.
- Majority quorums are what make consensus safe, and flexible quorums only require the election and replication quorums to intersect.
🧠 Check your understanding
0 / 4-
1N = 5, W = 2, R = 3. Does every read see the latest completed write?
With W + R = N, a write set of 2 and a read set of 3 can be disjoint, using all 5 replicas exactly once. R being a majority is tempting but irrelevant: the read only needs to overlap the write set, and with W = 2 it can miss it.
-
2A Cassandra table uses QUORUM for reads and writes with RF 3. Which statement is true?
Quorum overlap ensures the newest completed write is in the reply set, but it does not make the system linearizable: failed writes are not rolled back and clock skew can make LWW pick an older value. Linearizable conditional updates need lightweight transactions (Paxos).
-
3You run RF 3 in each of two regions and need writes to survive the loss of an entire region. Which choice works?
LOCAL_QUORUM only needs 2 of 3 replicas in the local region, so it keeps working if the other region disappears. QUORUM looks safe but needs 4 of 6, and only 3 remain after a region loss; EACH_QUORUM and ALL also require the lost region.
-
4What do Merkle trees speed up in anti-entropy repair?
Replicas compare root hashes and recurse only into differing subtrees, so they stream only the ranges that differ. They do not order writes: that is the job of versions or vector clocks, which is the tempting confusion.
Where to go next
- Distributed consensus (Raft and Paxos): how majority quorums plus a leader turn overlap into linearizable replicated logs.
- Leader election, leases and locks: what happens when you need exactly one actor, and why fencing tokens matter.
- Gossip and failure detection: how leaderless clusters decide which replicas are up before they pick a quorum.
- CRDTs and conflict resolution: merging concurrent writes instead of letting LWW throw one away.
Finished this lesson?
Mark it complete to track your progress across the roadmap.