Articles

Quorum Consensus Explained: N, W, and R

Quorum consensus lets distributed databases tune consistency and availability by requiring reads and writes to touch overlapping subsets of replicas.

The Lycoris Team The Lycoris Team · · 4 min read
Rows of server racks with connecting cables

Quorum consensus is a way for a distributed database to stay correct without requiring every replica to agree on every operation. Instead of waiting for all N copies of the data to confirm a write, or reading from all of them to be sure you have the latest value, quorum systems require only a large-enough subset — a quorum — to participate, and guarantee correctness by making sure the read and write quorums always overlap.

It’s the mechanism behind the tunable consistency in systems like Cassandra and DynamoDB, and it’s a direct, practical answer to the tradeoffs described by the CAP theorem: quorum systems let you pick, per operation, how much consistency you’re willing to trade for availability and latency.

The N, W, R model

Three numbers define a quorum configuration:

  • N — the number of replicas a piece of data is stored on.
  • W — the number of replicas that must acknowledge a write before it’s considered successful.
  • R — the number of replicas that must respond to a read before it returns a result.

The guarantee that makes this work is simple: if W + R > N, every read quorum overlaps with every write quorum by at least one replica. That overlapping replica is guaranteed to have seen the most recent write, so a read that consults R replicas and takes the most recent value among them is guaranteed to see the latest write — even though it didn’t contact every replica.

N = 3 replicas
W = 2, R = 2  →  W + R = 4 > 3  →  every read overlaps every write

With N=3, W=2, R=2, a write only needs 2 of 3 replicas to succeed, and a read only needs to check 2 of 3 — but because 2+2 exceeds 3, any read quorum and any write quorum are mathematically guaranteed to share at least one replica.

Tuning the tradeoffs

Different W/R splits produce different behavior for the same N:

ConfigurationBehavior
W = N, R = 1Fast reads, slow/fragile writes — every replica must confirm a write, but a read can trust any single replica
W = 1, R = NFast, available writes — one replica accepting is enough — but reads must check everything to be sure they see the latest data
W = R = majority of N (e.g. 2 of 3)Balanced; commonly the default, since it tolerates one replica being unavailable on either side

This is a per-operation dial, not a single system-wide setting in most implementations — a write path that can tolerate slightly stale reads (an activity feed) can use a lower R, while a path that can’t (an account balance) can raise both W and R closer to N. That flexibility is the main advantage quorum consensus has over strict, all-or-nothing replication: you don’t have to make one consistency decision for the whole system, the way you would with strong synchronous replication applied uniformly.

What happens when W + R ≤ N

If the quorum sizes don’t overlap, the guarantee breaks: a read quorum can consist entirely of replicas that haven’t seen the latest write yet, and the read returns stale data without any indication that it might be stale. Some systems deliberately run this way — it’s how you get eventual consistency rather than strong consistency, trading a guarantee of freshness for lower latency and higher availability, the same tradeoff described in our piece on eventual consistency.

Neither configuration is “wrong” — it depends on whether the application can tolerate reading slightly stale data in exchange for faster, more available operations.

Quorum consensus vs consensus algorithms like Raft

It’s worth distinguishing quorum-based replication from consensus algorithms like Raft. Raft also relies on majority quorums internally — a leader needs acknowledgment from a majority of nodes to commit a log entry — but Raft additionally solves leader election and guarantees a single, strictly ordered log that every node eventually replays identically. Quorum consensus in the N/W/R sense doesn’t elect a leader or enforce a single global order; any replica can typically accept a write, and conflicting writes to the same key from different replicas have to be resolved some other way, often with version vectors or a CRDT-style merge rule.

In short: Raft uses a quorum to get strong, ordered consistency with a single leader. N/W/R quorum systems use a quorum to get tunable consistency without a leader at all, accepting more complexity around conflict resolution in exchange for higher write availability.

Failure handling

Quorum systems tolerate replica failures gracefully, up to a point. With N=3 and W=R=2, the system keeps operating correctly with one replica down — reads and writes just contact the two that remain. Once more than N − max(W, R) replicas are unavailable, the system can no longer form a valid quorum for at least one operation type, and it has to choose between rejecting the operation (favoring consistency) or relaxing the quorum requirement temporarily (favoring availability) — a decision usually made explicit in the database’s configuration, sometimes called “sloppy quorums.”

The takeaway

Quorum consensus replaces “every replica must agree” with a weaker but sufficient guarantee: as long as the read and write quorum sizes sum to more than the total number of replicas, every read is guaranteed to overlap with the most recent write. That single inequality — W + R > N — is what lets distributed databases offer a tunable spectrum between strong consistency and high availability, configured per operation rather than fixed for the whole system.

Chisato Chisato · · 4 min read

What Are Vector Clocks? Ordering Distributed Events

A vector clock is a per-node counter array that lets distributed systems tell whether one event happened before another, without a shared clock.

#Distributed Systems #Databases #Cloud
Chisato Chisato · · 5 min read

Synchronous vs Asynchronous Database Replication

Synchronous replication waits for a replica to confirm a write before committing; asynchronous doesn't. The choice trades latency against durability.

#Databases #Distributed Systems #Cloud
Chisato Chisato · · 5 min read

Raft vs Paxos: Consensus Algorithms Compared

Raft and Paxos both let a distributed cluster agree on a value despite failures — Raft trades some flexibility for a design built to be understood.

#Distributed Systems #Computer Science #Databases