GOAT EngineerPreparing your learning space…

System Design · Concept Library · Free article

Read and Write Quorums: Wait for Enough, Not All and Not One

A read is guaranteed to overlap the latest write when W + R > N: with N copies, W must confirm each write and R must answer each read. You tune those numbers to trade read speed, write speed and availability, and the overlap still does not give you linearizability.

A quorum is the minimum number of replicas that must respond for a read or a write to count — and the trick is to wait for enough of them, not all and not one. Wait for just one replica and writes and reads are fast, but a read can land on a copy that never got the latest write and hand back stale data. Wait for all N replicas and every read is fresh, but a single slow or dead node stalls the whole operation. A quorum sits in between, and one rule makes it safe: W + R > N, where you write to W replicas and read from R of them out of N total. When those two counts add up to more than N, the set of replicas you wrote and the set you read are forced to overlap on at least one node — and that shared node has the latest write, so the read can’t miss it. That single inequality is the payoff of the whole chapter: it’s how "a write reached a majority" turns into "a read is guaranteed to see it." The dial is tunable — push cost onto writes (high W) or reads (high R) to fit your workload — but mind the fine print: a quorum guarantees freshness through overlap, not a global order, so it is not linearizability, and a "sloppy" quorum under failure quietly breaks even the freshness guarantee.

You saved it, refreshed, and saw the old value

A creator edits the destination on one of their Hatch links, hits save, and the app cheerfully says "Saved." They refresh the page to admire it — and see the old link, the one they just changed. A few seconds later it flips to the new one on its own. Nothing crashed, nothing errored; the database even confirmed the write. So what just happened? The write landed on one replica and was acknowledged, but the refreshed read was served by a different replica — one that hadn’t received the change yet. The reader looked at a copy that was a few seconds behind and reported what it saw. A ghost of the past, served with full confidence.

This is the precise wound the last two chapters left open. The consensus page taught you to call a write safe once a majority of replicas store it. The CAP page then warned — pointedly — that a majority write does not, on its own, make reads consistent: if the read is served by a replica that missed the write, it’s stale, exactly like the ghost above. The missing piece is the read side. This page is that piece: a single, beautiful rule that ties how many copies confirm a write to how many a read consults, so that a read can never miss the latest write. It’s called a quorum, and once you see why it works you’ll never be surprised by a ghost read again.

N, R, W — and why "wait for enough" wins

Three letters run this whole idea, so let’s pin them down. N is how many replicas hold a copy of each piece of data (say 3). W is how many of those replicas must acknowledge a write before you call it done. R is how many must respond to a read before you accept the answer. The system always sends each request to all N replicas in parallel — but it only waits for W (or R) of them to reply before moving on. So W and R are patience dials: how many confirmations you insist on before you trust the result.

One thing to settle now, because it quietly trips people up later: N is a per-key number, not the size of your cluster. It’s the replication factor — how many replicas own a copy of each key — and a real cluster usually has far more nodes than N (think three replicas per key across a fleet of fifty machines). Which specific N nodes own a given key isn’t kept in some giant lookup table; it’s computed, by hashing the key onto the ring and taking the next N nodes clockwise — the same consistent hashing that placed shards earlier. So when a read or a write arrives, the node handling it (the coordinator) hashes the key, finds that key’s N owners — its home replicas — and forwards the request to them. Every node knows the ring, so any node can route any request; there’s no central directory to consult. That’s the same instinct as shard routing: compute who owns the key, don’t ask everyone.

Look at the two extremes and you’ll feel why the middle is where the magic is. Set R = 1 and a read returns the instant any replica answers — blazing fast, but that replica might be the stale one, and you’ve just served a ghost. Set R = N and a read waits for every replica, so it’s always current — but now a single slow or dead node stalls or fails every read, which is fragile and slow. The same tension sits on the write side with W. Neither extreme is good: one is fast-but-wrong, the other is correct-but-brittle. The quorum idea is to wait for enough replicas — more than one, fewer than all — that freshness is guaranteed without needing everyone. This is the grown-up version of the "wait for one follower, not all" ack-count knob from leader–follower replication: same instinct, now made exact.

W + R > N — and why overlap guarantees a fresh read

Here is the entire secret of quorums, and it’s a single inequality: W + R > N. If the number of replicas a write touches plus the number a read touches adds up to more than the total, then the write-set and the read-set cannot avoid each other — they must share at least one replica. It’s pure pigeonhole: you can’t fit a group of W and a group of R into N slots without them overlapping, once W + R exceeds N. And that one shared replica is the whole game: it received the latest write (it’s in the write-set) and it’s being consulted by the read (it’s in the read-set), so the read is guaranteed to see the newest value. No ghost, ever.

Make it concrete with N = 3. Write to W = 2 and read from R = 2: that’s 2 + 2 = 4, which is greater than 3, so any 2 replicas you write and any 2 you read must share one — fresh read, guaranteed. Now the ghost from the top of the page: that was W = 1, R = 1, so 1 + 1 = 2, which is not greater than 3. The single replica you wrote and the single one you read need not be the same, so the read can miss the write entirely. The inequality is the line between "guaranteed fresh" and "maybe stale." Drag N, W, and R below and watch the write-set and read-set either overlap or slip past each other:

The interactive version of this example is available when JavaScript loads.

When replicas disagree, newest version wins

Here’s a piece we glossed over, and it’s the one that makes reads finally click. When a read consults its R replicas, they can hand back different values — some fresh, some behind — because replication is asynchronous and not every replica has caught up. So how does the coordinator (the node handling your request) decide which value to return? Every stored value carries a version: a timestamp, or a number that only ever goes up, stamped on it at write time. The coordinator gathers the R responses, compares their versions, and returns the one with the newest version. That’s the whole resolution rule — newest version wins.

And this is where the overlap rule earns its keep a second time. Because W + R > N forces the read set to include at least one replica the write reached, the latest write is always among the R responses — so "the newest version I saw" is always the true latest value, never a ghost. Overlap doesn’t just mean a fresh copy exists somewhere out there; it means the coordinator is guaranteed to be holding one and can pick it out by version. Choose a read set below and watch the coordinator resolve it — including the case where you read too few and get the ghost:

The interactive version of this example is available when JavaScript loads.

The configs everyone actually uses

Because W + R > N can be satisfied many ways, you get a dial, and three settings cover almost everything you’ll meet. W = N, R = 1 makes reads instant and always fresh (you only need one replica, and every replica already has the write) — but writes must reach all N, so one slow node drags every write. That’s the read-heavy choice. W = 1, R = N is the mirror: writes fly (one ack is enough) while reads must consult everyone — the write-heavy choice. And W = R = a majority (⌊N/2⌋ + 1) is the balanced default: both operations wait for just over half, W + R > N holds, and the system keeps serving as long as a minority of replicas is down. Most production systems live here.

The three canonical quorum configs (N = 3 shown).
ConfigReadsWritesSurvivesReach for it when
W=N, R=1 (3/1)Instant, always freshSlow — needs all 3No node down for writesRead-heavy, writes rare
W=1, R=N (1/3)Slow — needs all 3Instant, one ackNo node down for readsWrite-heavy, reads rare
W=R=quorum (2/2)Fast (waits for 2)Fast (waits for 2)A minority (1 of 3) downBalanced — the usual default

Notice all three satisfy W + R > N, so all three give fresh reads — they differ only in which operation pays the price. That’s the mental model to carry: you’re not choosing whether to be consistent, you’re choosing where to put the cost — on reads, on writes, or split evenly. The next section turns that into a dial you can feel.

Read speed, write speed, fault tolerance — pick your poison

Once you see the three configs, the deeper truth clicks: R and W give you a three-way tug-of-war, and you cannot win all three at once. Raise R and reads get slower (they wait for more replicas). Raise W and writes get slower. Lower both and everything speeds up and you can tolerate more dead nodes — but push them low enough that W + R is no longer greater than N and your reads start going stale. Fast reads, fast writes, high fault tolerance, guaranteed freshness: you get to pick which of these you spend on, and which you give up. Drag R and W and watch the three meters fight each other:

The interactive version of this example is available when JavaScript loads.

A quorum waits for the slowest replica it needed

Here’s the mechanism behind "higher R is slower," and it’s sharper than it first looks. When a read needs R responses, the system fires the request at all the replicas at once and then waits for the R-th one to come back — which is the slowest of the R it required. So the more replicas you insist on, the more likely your answer is gated by a straggler having a bad moment: a garbage-collection pause, a busy disk, a slow network hop. Raising R doesn’t add a little latency linearly; it raises your exposure to the worst replica in a bigger group.

At scale this becomes the dominant effect, and the numbers are startling. Suppose each replica answers within one second 99% of the time — a 1-second 99th-percentile, which sounds fine. Now imagine a request that has to collect responses from 100 such replicas in parallel: the chance that at least one of them lands in its slow 1% is so high that roughly 63 out of 100 user requests end up waiting more than a second. This is the "tail at scale" effect, and it’s exactly why production systems keep R and W as small as the freshness rule allows rather than cranking them toward N. Waiting for fewer replicas isn’t just cheaper coordination — it’s skipping the stragglers.

A quorum guarantees overlap — not a global order

This is the part almost every explanation skips, and it’s the one a senior engineer is expected to know. W + R > N guarantees that a read overlaps the latest write — that it touches at least one replica holding the newest value. It does not give you a single agreed order of operations across the whole system. Overlap buys freshness in the simple case; it does not buy linearizability. And the gap between those two is where the surprising edge cases live:

Cases where a strict quorum still bites you

  • Two writes to the same key happen at nearly the same time and reach different subsets of replicas. There’s no leader to declare a winner, so the replicas genuinely disagree on which is "latest," and the conflict has to be resolved afterward — different readers can see different winners in the meantime.
  • A read that runs concurrently with a write may return either the old value or the new one — it’s a race, not a guarantee. The quorum promises you won’t miss a completed write, not that you’ll see an in-flight one consistently.
  • A write that reached only some replicas — fewer than W, so it was never acknowledged — is not rolled back. A later read can still stumble onto it on the replicas that did receive it.
  • Reads can appear to go backwards: because of timing and which replicas answer, a later read can return an older value than an earlier read saw. There’s no promise that successive reads only move forward in time.
  • A replica holding the newest value dies and is rebuilt from a stale copy — quietly dropping the number of up-to-date replicas below W, so the overlap math no longer holds even though your config still says W + R > N.

Reading the edge cases is one thing; watching them is another. Run each one under a leaderless quorum and then flip to consensus — a leader that forces every write into a single order — and watch the anomaly appear and then vanish:

The interactive version of this example is available when JavaScript loads.

So what does a quorum actually give you? Freshness through overlap in the common case, tunably and cheaply — but not a total order, not monotonic reads, not linearizability. If you need a genuine global order (every observer agrees on the exact sequence, every read reflects all prior writes), a quorum alone won’t get you there: you need a leader that imposes an order, which is consensus. The clean way to hold the two ideas apart: a leaderless quorum uses overlap for freshness; consensus uses a majority to agree on an order. Same arithmetic, different guarantee.

Sloppy quorums — availability, at the cost of the guarantee

One more wrinkle, because failures are the whole reason we replicate — and it needs a word we’ve been using loosely: "home." Everything so far pictured a key living on N specific replicas (our R1, R2, R3). In a real cluster of dozens or hundreds of nodes, those N aren’t random: each key is assigned to a fixed set of N nodes chosen by hashing the key onto the ring — the same consistent hashing that placed shards in an earlier chapter. Those N designated owners are the key’s home replicas (Dynamo calls the ordered list its "preference list"), and normally every read and write for that key goes to them. Every other node in the cluster is a non-owner for this key — not part of its home set, but available to help in a pinch.

Now the failure question. A strict quorum needs W of a key’s home replicas to acknowledge a write. But what if some of those home nodes are down? You have a choice: fail the write to stay strict, or accept it somewhere else to stay available. A sloppy quorum takes the second path — it writes to the first N healthy nodes it can find, pulling in non-owner nodes as temporary stand-ins even though they aren’t the key’s home nodes. The write succeeds, the system stays up, and each stand-in stores the value with a hint naming the home node it’s covering for. When that home node recovers, the stand-in forwards the write to it (that handoff is why it’s called hinted handoff) and deletes its own copy.

It’s a genuine availability win — but read the fine print, because it quietly breaks the one rule we built everything on. If the write landed on stand-in nodes instead of the home set, then the read set and the write set are no longer guaranteed to overlap: a reader consulting the home replicas can miss a write that’s sitting on a fallback node, even though your config still satisfies W + R > N. The overlap guarantee holds only while writes reach the home nodes; a sloppy quorum trades it away for a staleness window that lasts until hinted handoff catches everything up. Step through it and watch the guarantee break, then heal:

The interactive version of this example is available when JavaScript loads.

Keeping replicas in step: read repair and anti-entropy

Replicas drift apart — an async copy lags, a node was down during a write, a sloppy quorum parked a value off-home. Two mechanisms pull them back together. The first you’ve already met: read repair. Every time a read gathers its R responses and notices some replicas returned an older version, the coordinator writes the newest value back to the stale ones as it answers. Reads do double duty — they serve the user and heal the replicas they touch. The limit is right there in the name, though: read repair only ever fixes data that someone actually reads. A key nobody has looked at in months can stay diverged indefinitely.

That’s what the second mechanism is for. Anti-entropy is a background process that continuously compares replicas and reconciles their differences whether or not anyone is reading them. The naive way to compare — ship every value to every peer and diff — would drown the network, so replicas compare Merkle trees instead: a tree of hashes where each leaf hashes a small range of the data and each parent hashes its children. Two replicas swap root hashes first; if the roots match, everything beneath is identical and there’s nothing to do. If they differ, the replicas walk down only the branches that disagree, zeroing in on exactly the diverged data and exchanging that and nothing else.

Last-write-wins vs version vectors

Newest-version-wins handles replicas that are simply behind. But recall the nastier case: two clients write the same key at nearly the same instant, with no leader to order them, so two replicas end up holding values that are genuinely concurrent — neither happened "after" the other in any real sense. Newest-wins has no tiebreaker there, so the system needs a conflict-resolution policy. There are two classic ones, and the gap between them is a favourite senior interview probe.

The simple policy is last-write-wins: stamp every write with a wall-clock timestamp, and when two conflict, keep the higher timestamp and discard the other. It’s easy, and it’s what Cassandra does. The trap hides in the phrase "wall-clock": server clocks drift, so a write that truly happened later can carry a smaller timestamp than an earlier one and be silently thrown away. That’s not a stale read you’ll eventually repair — it’s a committed, acknowledged write that is simply gone, and you may never notice. Last-write-wins trades correctness for simplicity, which is fine for data you can afford to lose (a cache entry, a metric) and quietly dangerous for data you can’t.

The correct-but-costlier policy is a version vector: instead of one timestamp, each key carries a small set of per-replica counters that capture causality. With it, the system can tell "write B genuinely came after A" (keep B) apart from "A and B are truly concurrent" (neither wins). Concurrent writes aren’t silently dropped — they’re handed back to the application as siblings to merge with real meaning: union the two shopping carts rather than losing one. Riak works this way. You pay in complexity and in app-level merge logic, and you buy back exactly the writes last-write-wins would have eaten.

For some data types you can dodge the merge decision entirely with conflict-free replicated data types (CRDTs) — counters, sets, and the like, defined so that any two concurrent versions merge automatically with no lost update. That’s the sweet spot when your data fits one, and it’s covered on the CAP theorem page. The rule of thumb across all of this: last-write-wins where a lost write is acceptable; version vectors or CRDTs where it isn’t. Never point last-write-wins at money, inventory, or anything you’d be embarrassed to lose to a clock that was a few milliseconds off.

Leaderless quorum vs consensus — when to reach for which

You saw the difference in action earlier; here it is as a decision. Both a leaderless quorum and a consensus system lean on quorum overlap — but they spend it on different guarantees, and that determines what each is good for.

Two ways to use a quorum.
Leaderless quorumConsensus (leader)
Who orders writesNobody — resolved by version after the factA single leader imposes one total order
ConsistencyTunable / eventual (freshness via overlap)Linearizable (one agreed sequence)
Under a partitionKeeps serving, reconciles later (AP-leaning)Minority stops serving (CP)
Cost per writeCheap — no leader, no ordering round tripA leader plus a majority round trip
Best forHigh-volume data that tolerates eventual consistencySmall critical state that needs one true order

They aren’t really rivals — they’re different points on one dial, and large systems use both: a consensus group for the handful of things that must have a single order (who is the leader, cluster membership, config), and leaderless quorums for the bulk data where availability and tunability matter more. Need a global order? Reach for consensus. Need cheap, available, tunable freshness? A quorum is the tool. Whether a partition even lets you keep both consistency and availability is the CAP question underneath all of this.

Choosing R and W for your workload

All of it comes down to a per-workload choice: where do you want the cost, and how much staleness can you stomach? Four settings cover most of what you’ll build.

Pick the config to fit the workload (N held fixed).
WorkloadConfigWhy
Read-heavy, reads must be freshHigh W (up to N), low R (1)Reads are instant and always current; the rare writes pay the cost
Write-heavyLow W (1), higher RWrites fly on a single ack; reads consult more replicas to stay fresh
Balanced / general purposeW = R = quorumBoth fast, tolerates a minority down — the usual default
Availability-first, staleness OKR and W low, W + R ≤ N on purposeFastest and most available; you accept occasional stale reads

The same company makes opposite choices in the same system: the payments ledger wants durability and correctness (high W, strict quorum reads, never last-write-wins), while the activity feed wants speed and availability (low R and W, staleness fine). Start at quorum/quorum, move W up when reads dominate, move R up when writes dominate, and only drop below the freshness line when the data genuinely tolerates a ghost. You’re not choosing whether to be consistent — you’re choosing where to spend, one workload at a time.

The consistency knob, set per query

You rarely set N, R, and W once in a config file and forget them. In practice you tune the read or write per call, through a consistency knob the client library exposes — the same table, a different flag, and you’ve moved that operation along the dial. A few of the knobs you’ll actually type:

Tuning quorums by store

  • Cassandra — a fresh read: write and read the key at QUORUM, so W + R > N and the read overlaps the latest write. Drop the read to ONE for speed (fast, possibly stale), use ALL for the strongest read (fresh, but any down replica fails it), or LOCAL_QUORUM to keep the quorum inside one datacenter and skip cross-region latency.
  • DynamoDB — pass ConsistentRead: true for a strongly-consistent read (costs more read capacity and fails if the item’s replicas can’t be reached); the default eventually-consistent read is cheaper and may lag.
  • Riak — set r and w per request (both to quorum, say); on a conflict Riak hands back the concurrent versions as siblings for your app to merge.
  • The pattern under all of them: the knob lives on the operation, not the database. Your payment write and your feed read set it differently in the very same app.

Pitfalls

  • Assuming a majority write means fresh reads. It doesn’t, unless the read also consults enough replicas — W + R > N. A majority write plus a one-replica read is a ghost waiting to happen.
  • Setting R = W = N "to be safe." That’s the slowest, most fragile config — one dead node fails every read and every write. Quorum/quorum gives freshness and tolerates a minority down.
  • Believing a sloppy quorum keeps the guarantee. A write routed off the home set can be missed by a home-set read even though W + R > N still holds. It’s availability now, freshness after handoff.
  • Pointing last-write-wins at data you can’t lose. Clock skew silently discards a genuinely-later write — use version vectors or CRDTs for money, inventory, anything correctness-critical.
  • Treating a quorum as linearizable. It gives freshness through overlap, not a global order — concurrent writes, reads going backwards, and in-flight races all still happen. For a true order you need consensus.
  • Cranking R toward N for "stronger" reads without counting the tail. A higher R waits for a slower straggler, and at scale that tail dominates your latency.

Best practices

  • Start at quorum/quorum (W = R = ⌊N/2⌋ + 1). It’s fresh, fast, and survives a minority failing — the right default until a workload argues otherwise.
  • Tune per operation, not per system: high W / low R for read-heavy, low W / high R for write-heavy, and drop below W + R > N only where staleness is genuinely fine.
  • For anything that must be fresh, make the read overlap the write — a quorum read or a confirmed-leader read, never a single lagging replica.
  • Keep quorums local where you can (LOCAL_QUORUM and friends) so coordination stays inside one region instead of paying a cross-continent round trip per operation.
  • Choose a conflict policy on purpose: last-write-wins where a lost write is acceptable, version vectors or CRDTs where it isn’t.
  • Run both read repair and anti-entropy so hot data and cold data both converge.
  • When you truly need one global order, reach for consensus — not a bigger quorum.

From intern to principal, the questions you’ll get

What is a quorum? (intern)
The minimum number of replicas that must respond for a read or a write to count as successful. The idea is to wait for enough replicas to guarantee freshness — not just one (fast but possibly stale) and not all (fresh but fragile).
What does W + R > N give you, and why? (SDE2)
It forces the write set (W replicas) and the read set (R replicas) to overlap on at least one node — pure pigeonhole, since W and R can’t fit into N slots without sharing one. That shared replica holds the latest write, so every read touches a current copy and can’t miss the newest value.
A read consults R replicas that return different values — which one does it return? (SDE2)
Every value carries a version (a timestamp or a version number). The coordinator returns the response with the newest version. Because W + R > N guarantees the read set includes a replica the write reached, the latest write’s version is always among the responses, so "newest wins" always yields the current value.
Give the three canonical configs. (SDE2)
W=N/R=1 (read-heavy: instant fresh reads, slow writes), W=1/R=N (write-heavy: instant writes, slow reads), and W=R=quorum (balanced, tolerates a minority down). All satisfy W + R > N, so all give fresh reads — they differ only in which operation pays.
Does a quorum give you linearizability? (SDE3)
No. It guarantees overlap (freshness), not a total order. Concurrent writes have no agreed winner, a read concurrent with a write can go either way, and a later read can even return an older value than an earlier one. For a true global order you need consensus (a leader imposing one sequence).
Why is a higher R slower? (SDE3)
A read waits for the R-th fastest replica — the slowest of the ones it required. Requiring more replicas raises your exposure to a straggler having a bad moment. At scale this tail effect dominates: 100 replicas each at a 1-second 99th percentile means roughly 63% of requests exceed a second.
What is a sloppy quorum, and what does it cost? (senior)
Under failure it writes to the first N healthy nodes it can find — pulling in non-owner nodes as stand-ins — instead of failing when home replicas are down. It stays available, but it breaks the overlap guarantee: a home-set read can miss the write until hinted handoff forwards it back to the recovered home node.
How do replicas converge after drift? (senior)
Read repair writes the newest value back to any stale replica a read touches (fixes hot data). Anti-entropy runs in the background, comparing Merkle trees to find and exchange only the diverged ranges (fixes cold data that reads never touch). Together they deliver eventual convergence.
What breaks with last-write-wins? (staff)
It resolves conflicts by wall-clock timestamp, so under clock skew a genuinely-later write can carry a smaller timestamp and be silently discarded — a committed write simply gone, not just stale. Version vectors avoid this by detecting concurrency and surfacing siblings for the app to merge.
Is N the size of the cluster? (staff)
No. N is the per-key replication factor — how many replicas own each key, its home set. A real cluster usually has far more nodes than N. Which N nodes own a key is computed by hashing the key onto the ring (consistent hashing), so any coordinator can route a request without a central lookup.
When would you use a leaderless quorum versus consensus? (principal)
A leaderless quorum for high-volume data that tolerates eventual consistency — it’s cheap, available, and tunable. Consensus for the small critical state that needs one true order: leader election, locks, config, a ledger. Big systems use both, consensus for the control plane and quorums for the bulk data.
How would you tune R and W for a read-heavy service? (principal)
Push the cost onto the rare writes: high W (up to N) and low R (1), so reads are instant and always fresh. If a little staleness is acceptable, drop R and W below the freshness line for even more speed and availability, and reconcile with read repair and anti-entropy.

Wait for enough, and make the sets overlap

Nearby: Raft & Leader Election is the other way to use a quorum — a leader spending overlap on a total order instead of just freshness; Leader–Follower Replication is where the "wait for one, not all" ack-count knob this generalises first appeared; Consistent Hashing is how a key’s home replicas are chosen; and the CAP theorem is the law that decides whether a partition even lets you keep both consistency and availability. And the wound left open: every quorum here assumed the replicas are close together. Spread them across continents and each read and write quorum has to cross an ocean before it counts — which is exactly where the journey heads next.

By GOAT Engineer. Back to Concept Library. Privacy Policy · Contact.