Skip to content
StackDecode
System Design
18. Advanced Distributed ArchitectureAnimated

Distributed Consensus

Agreement across nodes.

The idea

Protocols such as Paxos and Raft keep a replicated log consistent.

Watch it work

Press play, pause, or step through. Some animations have settings you can change.

followerT0 L0followerT0 L0followerT0 L0followerT0 L0followerT0 L0
  • leader
  • candidate
  • follower
  • crashed

Five servers start as followers. Each waits for a heartbeat from a leader; if none arrives before a random timeout, it will stand for election.

1/10

Raft guarantees at most one leader per term and never loses committed entries.

Step by step

  1. 1Elect a leader
  2. 2Replicate entries
  3. 3Commit on majority
  4. 4Apply in order

Where it is used

Coordination and metadata.

Watch out for

Latency of cross-region quorums.

Related