A 5 node Raft cluster has 2 nodes in one datacentre and 3 in another 30 ms away. State exactly what Raft guarantees a client, compute the commit latency for a write when the leader sits in the 2 node site, and say what a read served by a follower may return.
A 5 node Raft cluster has 2 nodes in one datacentre and 3 in another 30 ms away. State exactly what Raft guarantees a client, compute the commit latency for a write when the leader sits in the 2 node site, and say what a read served by a follower may return.
Approach: State the safety property the protocol provides and the one it does not, then count the network round trips a commit needs given where the majority actually sits.
Raft guarantees one totally ordered log in which every committed entry appears on every future leader, so a committed write is never lost or reordered, and it costs one round trip to a majority, which here is 60 ms because the leader has to reach the other site. The majority of 5 is 3, and a leader in the 2 node site holds itself plus one local peer, so the third acknowledgement must come from the 30 ms site: one round trip is 60 ms, and the client sees that plus its own round trip. Moving the leader into the 3 node site reduces the commit to local latency, which makes leader placement a real operational decision rather than an accident of election order. Leader completeness is what Raft gives; it gives nothing about follower reads. A follower can lag by any amount and cannot know whether the leader has committed newer entries or whether it is itself following a deposed leader, so a stale follower read may return an arbitrarily old value and two reads from different followers can move backwards. A linearizable read requires going through the leader with a quorum confirmation or a lease, and the lease exchanges a clock assumption for that round trip.
Follow-up: How does the commit latency change if you add a sixth node in a third site 10 ms away?
Key concepts: log replication majority, commit latency, stale follower read, leader completeness.