Try
↑ ↓ move↵ openesc close

Interview prep / Quorums

Junior · Quorums · System design interview question

A store has N=5, W=3 and R=3. How many replicas can be down while reads still work, and while writes still work? What if the settings are W=5 and R=1?

Sketch your own answer first, then compare it with the one below.

A strong answer

With W=3 and R=3, either operation needs three live replicas. Five replicas minus three leaves two that may be down. So reads keep working with up to two replicas down, and so do writes. R plus W is six, which is above five, so a read also sees the latest acknowledged write.

With W=5 and R=1, the picture is lopsided. A read needs only one live replica, so it works with four down. A write needs all five, so a single replica being down blocks every write. R plus W is six again, so reads are still fresh, but the writes are now less available than on a single machine, because five things must all be up.

The general rule is that an operation needing k replies tolerates N minus k failures. Choosing R and W is choosing how to split that tolerance between reads and writes, while keeping their sum above N if you need fresh reads.

A quick sanity check is to ask what happens during a routine rolling restart, when one node is down at a time. W=5 would stall writes at every restart, which is a strong argument against it.

Sources

Learn it by running it

The quorums lesson explains the mechanism behind this question, and its lab lets you change the parameters and watch the effect.

Your progress is saved in this browser. Sign in to keep it on every device. Privacy · Terms