In this lesson · topic 1 of 7
Topic 1
What if there is no leader
4 min read
The leader is a bottleneck and a risk
In the last lesson every write went through one leader. If it fails, writes stop until a new one is chosen. If it is slow, everything is slow. Some stores avoid this by having no leader. A client, or any node acting for it, sends the write to several replicas directly.
That raises a question. Replicas can be down, slow, or unreachable on any given request. If the write has to reach all of them, a single bad replica blocks it. If it only has to reach one, the others may miss it, and a read that lands on a replica that missed the write returns old data.
Two dials
Say there are N replicas of each item. A write is declared successful once W replicas have acknowledged it. A read asks R replicas and takes the newest answer. W and R are the two dials.
Turn them low and the system is fast and always available, but reads can miss writes. Turn them high and reads are reliable, but one slow or dead replica stops operations. The question is where to set them, and whether there is a rule that tells you when a read is guaranteed to see the last write.
Predict first
In the lab’s simulation, with W and R both set to one and no failures at all, 5.5%measured of reads were stale.
A rule for the dials
There is a rule for choosing W and R so that a read is guaranteed to see an acknowledged write. It goes back to 1979. The next topic derives it and shows what it costs in latency and availability.