Real-World Case Studies: Consensus and Leader Election

✅ Source-checked. Each deep dive names its source, and we kept only what that source says. Found an error, or something the source doesn't support? Report it on the tracking issue.

Three generations of consensus in practice: Google's Chubby lock service (Paxos), the Raft algorithm designed to be understandable, and etcd, the Raft-based store behind every Kubernetes cluster.


🏢 Deep Dive 1: Google Chubby, Consensus as a Lock Service

Source: Mike Burrows, The Chubby lock service for loosely-coupled distributed systems (OSDI 2006). Everything in this section comes from the paper.


🗳️ Deep Dive 2: Raft, Consensus Designed to Be Understood

Source: Diego Ongaro and John Ousterhout, In Search of an Understandable Consensus Algorithm (Extended Version) (2014). Everything in this section comes from the paper.


☸️ Deep Dive 3: etcd, the Raft Store Under Kubernetes

Sources: etcd docs: FAQ and Tuning; Kubernetes docs: Cluster architecture and Operating etcd clusters for Kubernetes. Everything in this section comes from those pages.


ℹ️ An earlier version of this page said Borg relies on Chubby and that Chubby's master lease is "typically 12 seconds". The paper describes a master lease of "a few seconds", and 12 s is the default extension of a client's session lease. It also mentioned Netflix's Titus platform running on etcd. We couldn't source the Borg and Titus claims, so we removed them.

🎯 System Design Interview Takeaways

  1. Use a consensus service, don't build one. Chubby, ZooKeeper and etcd exist so other systems can elect leaders and store small, critical metadata safely.
  2. Leases make leader reads cheap. While a leader's lease is valid, no other leader can exist, so it can answer reads alone.
  3. Fence stale leaders. A sequencer or fencing token lets downstream servers reject a former leader that doesn't know it has lost its lock.
  4. Run an odd number of members. Adding a fourth member to a three-member cluster costs more and tolerates no extra failure.