The Consensus Problem and Atomic Commit (2PC)
The last course ended on a hard truth: consensus — getting a set of nodes to agree on a single value — is impossible to guarantee in an asynchronous system with failures (FLP). Th…
Consensus and Replication covers: The Consensus Problem and Atomic Commit (2PC), Raft, State Machine Replication, Quorums, and Consistent Hashing, Consistency Models, CRDTs and the Ruby Distributed-Systems Lens. Year 3, Quarter 9. Includes 11 exercises and 3 projects.
This course unlocks once you've finished its prerequisite. Open prerequisite →
The last course ended on a hard truth: consensus — getting a set of nodes to agree on a single value — is impossible to guarantee in an asynchronous system with failures (FLP). Th…
Consensus was, for decades, synonymous with Paxos — a correct but famously baffling algorithm that even experts struggle to explain, let alone implement correctly. Then in 2014, R…
Raft gives you a consistent replicated log. This lesson is what you do with it — and how replication and partitioning actually build the fault-tolerant, scalable data systems you …
"Consistency" is one of the most overloaded words in computing, and two of its meanings — linearizability and serializability — sound almost identical, are constantly confused (ev…
This lesson closes the distributed-systems block with the technique that makes coordination-free collaboration possible, and then cashes the whole quarter into the tools you use. …
- [ ] Implement Two-Phase Commit (2PC) in Ruby — Coordinator + 2 participants, handle commit and abort - [ ] Diagram the Raft leader election process — Draw state transitions: fol…
- [ ] MIT 6.5840 Lab 3A: Raft Leader Election — Implement leader election with randomized timeouts - [ ] MIT 6.5840 Lab 3B: Raft Log — Implement log replication, AppendEntries RPC…
- [ ] MIT 6.5840 Lab 4A: KV Raft — Key/value service on top of Raft (without snapshots) - [ ] MIT 6.5840 Lab 4B: KV Raft with Snapshots — Add snapshot support for log compaction -…
- [ ] Implement a simplified Raft in Ruby — Leader election, log replication, and commitment across 5 nodes; test with simulated network partitions and leader failures; visualize …
Implement 2PC with a coordinator and 3 participants communicating via TCP sockets. Simulate participant crashes (random failures) and show how 2PC blocks. Then implement a timeout…
Implement 4 CRDTs: G-Counter (grow-only counter), PN-Counter (increment/decrement), G-Set (grow-only set), and LWW-Register (last-writer-wins). Write property-based tests proving …
Build a consistent hashing ring in Ruby with virtual nodes. Support adding/removing servers, key lookup, and demonstrate minimal key redistribution when servers change. Visualize …
- [ ] What is the consensus problem? Why is it hard in distributed systems? - [ ] Explain Two-Phase Commit. What happens when the coordinator crashes? - [ ] Explain Raft consensus…
- [ ] Course 9.1 knowledge check passed - [ ] Course 9.2 knowledge check passed - [ ] Distributed KV Store with Raft capstone completed
14 lessons. Read in order; spiral back when you need to. By the end you'll have used the core ideas twice — once on the abstract, once on something you'll meet at work next week.