Skip to content

Quorums: how many replicas must agree

The replication module ended with a question: when the network splits, who gets to decide? A quorum is the simplest answer. Keep a value on N replicas. A write is done when W of them have acknowledged it, and a read is done when R of them have replied. The Dynamo paper describes this with two configurable numbers, R and W: R is the minimum number of nodes that must take part in a successful read, and W the minimum for a successful write. It adds that setting R and W so that R + W > N yields a quorum-like system.

The point of the inequality is overlap. A write reaches at least W replicas and a read asks at least R. If R + W is more than N, those two groups cannot be disjoint, so at least one replica that answers the read has seen the latest write. The reader then needs a way to tell which answer is newest, such as a version number, and it picks that one.

Mental model. A club votes by sending notes to its members. A decision counts when enough members have signed it. If any decision needs more than half the signatures, then any two decisions share a member, and that member can say which came first.

In the lab, a value starts at version v1 on every replica. A partition then cuts the last replicas off from the rest. A client on each side writes, then reads, and the lab shows what each side could do. Start with three replicas, a read quorum of two, a write quorum of two and one replica cut off.

A value is stored on N replicas. Choose how many must acknowledge a write (W) and answer a read (R), cut a minority off, and see which side can still read and write.

Replicas (N)
2
2
1
600 ms
  • N1ReachableVersion v2
  • N2ReachableVersion v2
Network up
  • N3ReachableVersion v2

The network heals. Every replica now holds v2.

Results of the run

Read and write quorums overlap
Yes: 2 + 2 > 3
W is at most half of N, so two sides could both write
No
Main side can write
Yes
Main side can read
Yes
Cut-off side can write
No
Cut-off side can read
No
State of each node at the event shown
NodeStateHolds
N1ReachableVersion v2
N2ReachableVersion v2
N3ReachableVersion v2
Every event in words
Every event of the run, in time order
At secondEvent
0 ms3 replicas hold version v1. A write needs 2 acknowledgements and a read needs 2 replies.
100 ms1 replicas are cut off from the other 2.
200 msA client on the main side writes v2. It can reach 2 replicas and needs 2, so the write succeeds.
300 msA client on the main side reads from 2 of the 2 replicas it can reach and gets v2, the latest version it can know of.
400 msA client on the cut-off side tries to write. It can reach 1 replicas but needs 2, so the write is refused.
500 msA client on the cut-off side tries to read. It can reach 1 replicas but needs 2, so the read is refused.
600 msThe network heals. Every replica now holds v2.

Illustrative values, not benchmarks of any real product.

Model notes

Assumptions

  • Each replica holds one version of one value. A write goes to every replica the client can reach, and succeeds when at least W of them acknowledge it.
  • A read asks R replicas and takes the ones with the oldest version first, which is the worst case for freshness.
  • The cut leaves a minority of replicas on one side. A client on each side can reach only its own side.

Simplifications

  • A refused write changes nothing. A real system can leave a partial write behind and repair it later.
  • Versions are plain labels. A real system needs version numbers, timestamps or vector clocks, and a way to reconcile conflicts.

Parameter values are illustrative. They are not benchmarks of any real product.

With those settings the main side holds two replicas, which is enough for a write quorum of two, so it can write and read. The cut-off side holds one replica, and needs two for both, so it cannot write and cannot read. The lab reports that the quorums overlap because 2 + 2 > 3. Nothing is stale and nothing conflicts, and the price is that the one replica on the small side is useless until the network heals.

Now change the settings and watch what each one gives up. Set Read quorum (R) and Write quorum (W) to 1, so that a request needs a single replica. Both sides can write, and the quorums no longer overlap, since 1 + 1 is not more than 3. When the network heals, the replicas hold two conflicting versions that something must reconcile. Set Write quorum (W) back to 3 with Read quorum (R) at 1 and the overlap returns, but a write now needs every replica, so with one replica cut off the main side cannot write at all.

N, R, W R + W > N Main side can write Cut-off side can write Cut-off side can read
3, 2, 2 (one replica cut off) Yes Yes No No
3, 1, 1 (one cut off) No Yes Yes Yes
3, 1, 3 (one cut off) Yes No No Yes
5, 2, 3 (two cut off) No Yes No Yes, but stale
5, 3, 3 (two cut off) Yes Yes No No

The fourth row is the trap. With five replicas, W = 3 is a majority, so two sides cannot both write, and that is why the cut-off side cannot. But R + W is 5, not more than 5, so the read can be answered by two replicas that missed the write, and the cut-off side reads a stale value. Two different inequalities guard two different things. R + W > N makes a read meet the latest write. W more than half of N keeps two sides from both writing.

Check your reading of the table.

Check your understanding: quorums

This quiz needs JavaScript to check your answers.

Question 1 of 3

A value is kept on five replicas with a read quorum of 2 and a write quorum of 3. A partition cuts two replicas off from the other three. After a write on the main side, a client on the cut-off side reads.

What happens to the read?

Choose one answer.

Question 2 of 3

With five replicas and a write quorum of 3, how many replicas can be unreachable while a write still succeeds?

Enter a number and choose its unit.

replicas
Question 3 of 3

A partition cuts one replica of three off from the other two.

Which setting lets both sides accept a write?

Choose one answer.

What happens if more replicas are cut off?

Section titled “What happens if more replicas are cut off?”

The lab only lets you cut off a minority: at most one of three replicas, or two of five. That is deliberate, because a cut that leaves no side with a majority leaves no side able to use a majority rule, and the system would refuse everything. With a majority quorum, as many replicas can fail as are left over once a majority is taken: one of three, two of five. The Raft paper makes the same count for its own protocol: a cluster of five servers can tolerate the failure of any two. A fourth replica adds nothing for this purpose, since a majority of four is three, so four replicas still tolerate only one failure. The extra cost buys no extra fault tolerance.

A quorum rule is a statement about sets of replicas, and three things sit outside it.

  • The sets must be fixed. Dynamo does not stay with strict quorum membership. Its sloppy quorum performs reads and writes on the first N healthy nodes, which may not be the usual ones, and a node that stands in keeps a hint of the replica it replaces. The overlap argument above assumes the same N replicas every time, so it does not carry over to a sloppy quorum as stated. The paper’s reason is availability: a traditional quorum approach would be unavailable during server failures and network partitions.
  • A failed write may leave something behind. The lab refuses a write that cannot reach W replicas and changes nothing. A real system can leave copies on the replicas it did reach, so a later read may or may not see a write that its client was told had failed.
  • Versions must be comparable. The lab uses plain labels. A real system needs version numbers, timestamps or vector clocks, and a way to resolve two versions that neither came before the other.

There is also a cost that has nothing to do with failures. The Dynamo paper notes that the latency of a read or write is dictated by the slowest of the R or W replicas, so R and W are usually set below N for better latency. A bigger quorum is a safer one and a slower one.

  • A write that needs W acknowledgements and a read that needs R replies must share a replica when R + W > N, so a read meets the latest write.
  • W more than half of N keeps two sides of a partition from both writing. R + W > N alone does not: with 3, 1, 1 both sides write and the replicas end with two versions.
  • Of five replicas with two cut off, R = 2 and W = 3 lets the small side read a stale value, because 2 + 3 is not more than 5. R = 3 and W = 3 does not.
  • A majority quorum survives as many failures as are left over from a majority: one of three, two of five. Four replicas still survive only one.
  • The guarantee assumes fixed sets of replicas. Sloppy quorums, half-finished writes and incomparable versions are outside it.

Next: Consensus and leader election.

Your progress

Built by GhaziAlibi.

© ShardCraft. All rights reserved.