Data & storage · Intermediate · 11 min

Consensus & Leader Election

Separate leader election from the rules that preserve committed history.

STEP 1 / 12
Start with one replicated leader — isometric concept diagramClients need a precise acknowledgement boundary. Components: 1. Caller. Representative clients, not a literal user count; 2. Leader. Durable or explicitly scoped state. Connections: 1. Caller to Leader: Start with one replicated leader; 2. Leader to Caller: Reply: Leader. Illustrations are conceptual, not deployed capacity or user counts.Caller → Leader: Start with one replicated leader1Leader → Caller: Reply: Leader2Caller: Representative clients, not a literal user count1CallerRepresentative clients, not aliteral user countLeader: Durable or explicitly scoped state2LeaderDurable or explicitly scoped state
1Caller2Leader
  1. 1Caller → LeaderRequestStart with one replicated leader
  2. 2Leader → CallerReplyReply: Leader

Conceptual illustration · figures do not imply user counts, deployed capacity or replica counts.

2 components visible · Caller + Leader highlighted

Orange: request / query · Blue: reply · Purple: event / control · Arrows show direction; speed is illustrative.

You’ll learn

  • An epoch helps distinguish stale leadership.
  • Commit rules preserve a common ordered prefix.
  • Leader election must preserve committed entries.

PUT THE IDEA TO WORK

From learning to practice

No related challenges are currently available. Browse practice

RELATED PATTERNS

Explore architecture patterns ↗

Further reading

Raft paper ↗