Consensus & Coordination
Replication gave you several copies, and failures gave you the question of who is in charge. This module is about getting nodes to agree despite crashes, pauses and partitions: how many of them must say yes, how they choose a leader, why an old leader can still do damage, and why asking several databases to commit together can leave them waiting.
You will work with a partition simulator in two modes, quorums and leader election, and every lesson has a moment where you change one setting and see which side can still act or which write survives.
The lessons
Section titled “The lessons”- Quorums: how many replicas must agree (20 min). Read and write quorums, what R + W > N guarantees, and which side of a partition can still work.
- Consensus and leader election (22 min). Agreement by majority, terms and votes, and what the election timeout costs.
- Leases and fencing tokens (22 min). A leader that pauses and wakes up after it was replaced, and the token that stops its write.
- Distributed locks and coordination services (18 min). A lock as a lease and a token, locks for efficiency and for correctness, and what etcd and ZooKeeper provide.
- Two-phase commit and why it blocks (16 min). How a coordinator commits several databases together, and what a failed coordinator leaves behind.
- Recap and quiz (12 min). The module in one page, a checklist, and a quiz.
What you will be able to do
Section titled “What you will be able to do”- Say which side of a partition can read and write for a given number of replicas, R and W.
- Explain how an election works, and work out the time without a leader from the timeout.
- Follow a late write from a replaced leader, and say what the storage must check to refuse it.
- Decide whether a lock is for efficiency or for correctness, and what that requires.
- Explain why two-phase commit blocks when the coordinator fails, and how consensus removes the block.
All the numbers in the labs are illustrative. They are for comparing choices, not for forecasting any real product.
Built by GhaziAlibi.
© ShardCraft. All rights reserved.