Definition · Synchronous write, and its acknowledged-by distributionA synchronous write is acknowledged to the client only after every follower has applied it. If each follower's reply time is independent with CDF F, the write is acknowledged by t with probability F(t)^(N − 1), the CDF of the maximum of the N − 1 followers.
Independence is a real assumption and it is named here rather than buried. Two replicas sharing a rack switch, a hypervisor or a garbage collector do not fail to reply independently, and this lesson's arithmetic describes replicas that do.
one replica's ack time, as ms:weight over a total weight of 1000
t weight F(t) F(t)² = P(both followers acked by t)
2 600 0.600 0.360000
4 300 0.900 0.810000
8 70 0.970 0.940900
16 22 0.992 0.984064
24 6 0.998 0.996004
40 2 1.000 1.000000
p99 of one replica = 16 ms first t with F(t) ≥ 0.99
p99 of the maximum = 24 ms first t with F(t)² ≥ 0.99
Read the fourth row carefully, because it is the whole lesson. One replica is done by 16 ms in 99.2% of cases. Two replicas are both done by 16 ms in 98.4064% of cases — a little worse, not twice as bad — and that shortfall against 99% is what pushes the p99 out one step, to 24 ms.
Why three replicas do not cost three times one
N = 3, so the write waits for the slowest of 2 followers
the claim 3 × 16 ms = 48 ms
the truth 24 ms
ratio 48 / 24 = 2.00× too high
and the mean is not the story either
mean ack, one replica = 3.536 ms
mean wait, slowest of two = 4.704224 ms
p99 wait, slowest of two = 24 ms
The mean wait rises by about a third and the p99 rises by half, while the multiplicative claim charges three times. The reason is that latencies of parallel requests do not add — only latencies of sequential requests add. Three replicas contacted one after another really would cost something like 3×; three contacted at once cost the slowest of them.
Example · The asynchronous alternative, priced in bytesDrop the wait and replicate in the background. The write's latency becomes the leader's alone, and the data that has been acknowledged to a client but reached no other machine is rate × lag × bytes: at 2000 writes/s, a mean lag of 3.536 ms and 400 bytes a write, 2000 × 0.003536 × 400 ≈ 2828 bytes, about 2.83 kB. If the leader's disk is lost in that instant, those writes are gone and their clients were told they succeeded. That is the durability window, it is small here, and it is a number rather than a feeling.
Neither option is free and both are computable, which is the useful position to argue a design from: 8 ms added to the p99 of every write, or 2.83 kB of acknowledged data living in one place. Which is worse is a question about the business; which is which is a question this page answers.