liveBook · Manning

Chapter 10: Distributed consensus

What you will learn in chapter 10 of Think Distributed Systems

The introduction explains why distributed consensus matters: it lets redundant processes act as one and prevents disagreements that could make an application behave incorrectly.

After this chapter you will be able to

What it builds on

Section by section

Introduction

The introduction explains why distributed consensus matters: it lets redundant processes act as one and prevents disagreements that could make an application behave incorrectly.

Key terms: distributed consensus, redundant processes, lockstep, consensus problem, commit or abort, operation order, lock

10.1 The challenge of reaching agreement

This section defines distributed consensus, explains why realistic failures make agreement difficult, and clarifies what the FLP impossibility theorem does—and does not—rule out.

Key terms: distributed consensus, processes, system model, atomic commitment, Two-Phase Commit, transaction coordinator, safety, liveness, FLP Impossibility Theorem, asynchronous distributed system

10.2 System model

Defines the process, failure, and proposal model for consensus, then states the safety and liveness properties a consensus algorithm must satisfy.

Key terms: Processes, Values, crash failure, Propose(p, v), Decide(p, v), safety properties, validity, integrity, agreement, liveness properties

10.3 State machine replication

This section explains how consensus lets identical processes execute the same ordered commands, turning a process into a fault-tolerant replicated group.

Key terms: state machine replication, deterministic processes, same state, same inputs in the same order, distributed consensus, log, replicated key-value store, lockstep

10.4 The origin—and irony—of consensus

This section traces the origins of fault-tolerant consensus, explains why single-decision Paxos led to Multi-Paxos, and distinguishes Paxos’s fame from Viewstamped Replication’s earlier publication.

Key terms: Paxos, Multi-Paxos, write-once registers, state machine replication, Viewstamped Replication, Brian Oki, Barbara Liskov

10.5 Implementing consensus

10.5.1 Leader-based consensus

The section shows why a single decision-making leader guarantees consensus only in an ideal system model and is insufficient when processes or messages can fail.

Key terms: Benevolent Dictator for Life, BDFL, theoretical system model, realistic system model, system inconsistencies

10.5.2 Quorum-based consensus

This section explains how majority quorums enable agreement, why their overlap prevents split-brain decisions, and how many processes are needed to tolerate failures.

Key terms: quorum, Q > N/2, quorum intersection, splitbrain, f failed processes, f+1 nonfailed processes, N = 2*f+1

10.5.3 Combining leader and quorum

This section explains how consensus algorithms combine a quorum-elected leader with quorum acknowledgments before committing a proposed value.

Key terms: leader, quorum, proposes values, acknowledgments, committing a value

10.6 Raft

Introduces Raft as a leader-and-quorum consensus protocol for replicated logs, while noting its complexity and the scope of the version discussed.

Key terms: Raft, replicated logs, leader, quorum, message sequencing, message commitment, understandability, Raft consensus algorithm, original paper, variants

10.6.1 The log

This section explains how Raft uses consistent logs and leader eligibility to keep committed entries safe, then passes those entries to application state machines.

Key terms: log consistency, commit index, quorum, committed, state machine safety, leader election, most up-to-date logs, candidate, platform level, application level

10.6.2 Terms

This section explains how Raft uses increasing terms to organize leader election and log replication, and to prevent an outdated leader from acting.

Key terms: terms, logical clock, leader election, Request Vote protocol, log replication, Append Entries protocol, term number, fencing token, previous leader, current leader

10.6.3 Leader Election protocol

This section traces how a Raft node moves among Follower, Candidate, and Leader states to elect a leader and respond to a newer term.

Key terms: Follower, election timer, Candidate, term, RequestVote, quorum vote, split vote, Leader, demotion

10.6.4 Log Replication protocol

This section traces how a leader replicates a client’s log entry and advances the commit index after quorum acknowledgment.

Key terms: Log Replication protocol, Append Entries requests, quorum, commit index

10.6.5 State machine safety

This section defines Raft’s state machine safety property and explains how log-based leader election preserves committed entries.

Key terms: state machine safety, log entry, index, most up-to-date log, last entries, term, leader, quorum, future leaders, committed

10.7 Raft puzzles

This introduction sets up three Raft puzzles and encourages readers to use them to connect protocol details with system-wide behavior.

Key terms: Raft cluster, three nodes, third term, thinking in algorithms, thinking in distributed systems, systemic behaviors, implicit consequences

10.7.1 Puzzle 1

This puzzle identifies the leader for term 3 from the cluster’s logs and connects that evidence to the leader’s role in handling client requests.

Key terms: leader, term 3, log, client requests, followers

10.7.2 Puzzle 2

A Raft puzzle shows how a request present only in a leader’s log can be lost without violating state machine safety.

Key terms: leader, term, follower, log, committed, state machine safety

10.7.3 Puzzle 3

Puzzle 3 shows why Raft preserves a replicated but apparently uncommitted request when its leader crashes.

Key terms: acknowledgment, commit index, state machine safety, most up-to-date log, leader

10.8 Summary

The chapter summary recaps how state machine replication enables distributed consensus, why failures make consensus difficult, and how Raft divides the task.

Concepts explained in this chapter

← Chapter 9: Consistency Chapter 11: Durable executions →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.