Learn
Lesson · Replication and Consistency · Quorums

Sloppy Quorums and the Miss Probability

When R + W ≤ N the read set may be drawn entirely from nodes the write never reached, and the probability of that is a ratio of combinations: C(N − W, R)/C(N, R). At N = 3 with R = W = 1 it is exactly 2/3 — two reads in three see the old value. And R + W = N, which reads like the boundary of the guarantee, is 1/3 at three nodes: one read in three, for a system that has paid for three replicas.

R + W ≤ N: P(miss) = C(N − W, R) / C(N, R) N = 3, R = 1, W = 1 C(2,1)/C(3,1) = 2/3 N = 3, R = 2, W = 1 C(2,2)/C(3,2) = 1/3 N = 3, R = 2, W = 2 C(1,2)/C(3,2) = 0 the overlapping case R + W = N is not nearly R + W > N: here it is one read in three
The miss probability, as a ratio of combinations

Core ideas

What this lesson establishes

A counting argument, the assumption it rests on, and the reason the near-miss configuration is the worst place to stand.

1

A miss is a read set drawn entirely from the untouched nodes

The write reached W nodes and left N − W without it. The read misses exactly when all R of its nodes come from those N − W, and the number of such read sets is C(N − W, R) out of C(N, R) in total. Every quantity in that ratio is a combination, so the probability is an exact fraction rather than an estimate.

2

The uniform draw is an assumption, and it is stated

The formula counts read sets as equally likely, which is what a coordinator picking R nodes at random does. A coordinator that always prefers the same nodes — the nearest, the least loaded, the first in a list — has a miss probability that is not this number and may be 0 or 1 depending on where the write landed. The formula is the random-placement case, and real systems are often less random than that.

3

R + W = N is the worst place to stand

It is one short of a guarantee and it is paying the full price of N replicas. At N = 3 it misses one read in three; at N = 5 it misses one in ten. It never misses zero, and the single node that would fix it — one more in R or in W — is nearly always cheaper than the incident it prevents.

The material

Counting the read sets that miss

Where the ratio of combinations comes from, what it says at three nodes and at five, and what a miss does and does not mean.

Definition · Sloppy quorum, and the miss probability

A configuration with R + W ≤ N is a sloppy quorum: it has no overlap guarantee. If the read's R nodes are drawn uniformly from the N, the probability that the read set contains no node the write reached — the miss probability — is C(N − W, R) / C(N, R).

The counting is direct. There are C(N, R) possible read sets. A read set misses precisely when it avoids all W nodes the write reached, which means choosing all R of its members from the remaining N − W, and there are C(N − W, R) ways to do that.

N nodes; the write reached W of them; the read draws R uniformly read sets that miss = those lying inside the N − W untouched nodes = C(N − W, R) read sets in total = C(N, R) P(miss) = C(N − W, R) / C(N, R) and when R + W > N the numerator is C of a number smaller than R, which is 0 — the overlap theorem, arrived at by counting

That last remark is worth keeping: the overlap theorem and this formula are the same statement. When R + W > N there are no read sets that miss, so the numerator is zero; when R + W ≤ N there are some, and the formula says how many.

The edge case is not nearly the good case

N = 3 R W R + W P(miss) = C(3 − W, R)/C(3, R) 1 1 2 C(2,1)/C(3,1) = 2/3 = 66.66…% 2 1 3 C(2,2)/C(3,2) = 1/3 = 33.33…% 1 2 3 C(1,1)/C(3,1) = 1/3 = 33.33…% 2 2 4 C(1,2)/C(3,2) = 0/3 = 0 3 1 4 C(2,3)/C(3,3) = 0/1 = 0 N = 5 1 1 2 C(4,1)/C(5,1) = 4/5 = 80% 2 2 4 C(3,2)/C(5,2) = 3/10 = 30% 2 3 5 C(2,2)/C(5,2) = 1/10 = 10% 3 3 6 C(2,3)/C(5,3) = 0 = 0

Two patterns come out of the table. The R + W = N rows are never zero and they get better as N grows — one third at three nodes, one tenth at five — which is why the configuration survives in production long enough to be believed in. And the step from the last sloppy row to the first overlapping one is always one node, on either path.

Example · R = W = 1, and what two thirds actually means

The fastest possible configuration on three replicas: write to one node, read from one node. Both operations wait for a single machine, so both are as quick as the medium allows, and two reads in three that immediately follow a write return the old value. Note what this is not: the write is not lost. It is on a node, background repair will spread it, and a read a second later will very likely find it. The 2/3 is the probability at the moment before that happens — the same moment that “Replication Lag and Stale Reads” priced from the other direction.

So a sloppy quorum is a bet that reads rarely follow writes closely. That bet is sometimes right — an analytics store, a feed nobody re-reads immediately — and it is catastrophic for anything a user writes and then looks at. The number that decides it is this one, multiplied by how often your reads really do chase your writes.

Interactive

Sloppy quorums and the miss probability

C(N − W, R) ÷ C(N, R), and why R + W = N buys nothing

A sloppy quorum missesP(miss) = C(N − W, R) ÷ C(N, R)
read sets that miss the writeread sets that hit itthe overlapping configuration

Method

Pricing a configuration that does not overlap

Three of the four steps are arithmetic. The fourth is the one that decides whether the arithmetic applies to your system at all.

1

Confirm that R + W ≤ N, so there is something to compute

If R + W > N the miss probability is zero and the question is the overlap question instead. The formula returns zero in that case too, because C(N − W, R) is C of a number below R.

2

Compute C(N − W, R) and C(N, R) as integers, then reduce

Keep them as exact integers. These are small numbers and there is no reason to let a decimal in: C(2,1)/C(3,1) is 2/3, not 0.67, and the exact form is what makes the comparison with the neighbouring configuration obvious.

3

Compare with the configuration one node away

Raise R by one, then W by one, and compute both. One of them usually costs less than the other on your workload, and one of them is usually enough to reach R + W > N.

4

Check that your coordinator actually draws uniformly

If reads are routed by locality, by load or by a fixed preference list, the read set is not uniform and this probability is the wrong one. It may be better — a coordinator that reads and writes the same preferred node never misses — or much worse, and either way the formula is describing a system you have not got.

Missing the write, exactly

Score 0 / 0

Three replicas, one of each, and the two repairs

A key-value store is configured for speed: three replicas, write acknowledged by one, read served by one. Users report that a value they just saved sometimes comes back as it was. The question is how often “sometimes” is, and what the cheapest fix costs.

N = 3, R = 1, W = 1 the write reached 1 node; 2 nodes do not have it read sets that miss = C(2,1) = 2 read sets in total = C(3,1) = 3 P(miss) = 2/3 two reads in three see the old value repair 1: raise R to 2 C(2,2)/C(3,2) = 1/3 R + W = 3 = N, still no guarantee cost: the read now waits for the 2nd fastest of 3 repair 2: raise W to 2 as well C(1,2)/C(3,2) = 0/3 = 0 R + W = 4 > 3, guaranteed cost: the write now waits for the 2nd fastest of 3, which the quorum-latency lesson priced at 8 ms p99 so: 2/3 → 1/3 → 0, for two order statistics

The first repair halves the problem and does not solve it, which is exactly the trap: it will look like a fix in a test that issues ten reads, and it leaves a third of them wrong. R + W = N is not a weaker version of the guarantee, it is the absence of one with better odds.

The second repair costs the write an order statistic — the second fastest of three rather than the first — and that was priced at 8 ms at the p99 on the distribution this course has been using. Eight milliseconds on the write path to remove two thirds of a correctness problem is not a close call.

For a faded rehearsal, the same store is moved to five replicas and somebody proposes R = 2, W = 2 as a compromise. The supplied first move is C(3,2) = 3 and C(5,2) = 10. Compute the miss probability, then find every configuration on five nodes with R + W = 6 and say which of them you would choose for a workload whose reads outnumber its writes nine to one.

Common mistakes

1
Reading R + W = N as good enoughIt is one read in three at N = 3 and one in ten at N = 5, and neither is a rounding of zero. The configuration is especially convincing because it usually works, which means it fails in production under load and not in the test that sent twenty requests.
2
Assuming a miss means the write was lostA miss is a read that did not see a write which is sitting safely on W nodes. Anti-entropy, read repair and hinted handoff will spread it; the probability computed here is about the moment before they do. Confusing the two turns a staleness conversation into a durability panic and sends the investigation to the wrong place.
3
Applying the formula when the coordinator does not draw uniformlyLocality-aware routing, preference lists and least-loaded selection all break the uniform draw the counting rests on. Before quoting C(N − W, R)/C(N, R), check how your read set is actually chosen — and if it is chosen the same way the write set was, you may have a much better number than the formula, with a much worse failure mode when that node is down.

Check your understanding

✓
Finish when R + W = N reads to you as a configuration with a number attached, not as a near miss.

You should be able to compute C(N − W, R)/C(N, R) as an exact fraction, state it for the common small configurations without looking them up, name the cheapest change that reaches R + W > N, distinguish a miss from a lost write, and check the uniform-draw assumption against your own coordinator.

Note: Every configuration so far has been a free choice of R and W. One choice is not free: a cluster that has to agree on a leader or a membership list uses a majority, and a majority's size is forced by n. “Majorities and Fault Tolerance” works out what that costs — and shows that the fourth node in a three-node cluster adds nothing at all.

Kept in this browser only, for you. Nothing is sent anywhere and nothing checks it. Carry it to another device.

Feedback and recommendations

Something to change about this lesson? Write it down, tick it off when it is handled, and export the list when you want to act on it. Kept in this browser only: nothing is sent anywhere, and nobody is notified.

No recommendations yet for this lesson.