Module 09 Review: Coordination
1. Cheat Sheet: The Big Picture
In Distributed Systems, “Coordination” is the art of getting independent nodes to agree.
| Concept | The “One Liner” | Key Tool/Algo | Trade-off |
|---|---|---|---|
| Leader Election | “Who is the boss?” | Raft, Paxos, Bully | Availability (CP system pauses during election). |
| Split Brain | “Two bosses shouting orders.” | Quorum (N/2)+1 |
Requires odd number of nodes (3, 5, 7). |
| Distributed Lock | “Traffic light for resources.” | Redlock, ZK Lock | TTL vs Correctness (Clock skew risks). |
| Fencing Token | “The Shield against Zombies.” | Monotonic ID | Requires Storage Layer support. |
| Consensus | “Agreeing on the Log.” | Raft, ZAB | Latency (Round trips for ACKs). |
| Service Discovery | “Phonebook for dynamic IPs.” | ZooKeeper, Etcd | Complexity vs Static Config. |
| Ephemeral Node | “I exist only while I am alive.” | ZooKeeper | Heartbeat traffic overhead. |
2. Interactive Flashcards
Test your recall. Click a card to flip it.
What is Split Brain?
A condition where a network partition causes a cluster to split into two independent groups, both potentially electing a leader.
Why do we need Fencing Tokens?
To prevent a "Zombie Leader" (who was paused by GC) from overwriting data written by a new Leader.
What is the Quorum for 5 nodes?
3 nodes. Formula: (N/2) + 1.
What is an Ephemeral Node?
A ZooKeeper node that is automatically deleted when the client session ends (disconnects).
Difference between Raft and Paxos?
Raft is designed for understandability and has a strong Leader. Paxos is the theoretical foundation but is complex to implement.
Why is Redlock controversial?
It relies on system clocks. If a clock jumps, a lock might expire prematurely, violating safety.
What is the CAP Theorem trade-off for Leader Election?
CP (Consistency & Partition Tolerance). The system becomes unavailable during an election to ensure safety.
3. What’s Next?
You have mastered the art of agreement. Next, we move to Simple Services, where we build real-world systems like ID Generators, Rate Limiters, and Pastebins using these coordination primitives.