What is Consensus?
Consensus, told as a story about control rooms raising hands until a majority agrees.
Several control rooms, and each says something different.They can't even agree on who's on call today.
When several decide alone at once, things stop matching.Without talking to each other, decisions scatter.
Raise hands, and once more than half agree, it's settled.Once agreement clears half (a quorum), it's final.
Even if one or two are down, the rest can still decide.Everyone ends up with the same log, and a new leader is picked the same way.
Voting is slow — everyone has to wait.So it isn't used for urgent calls — only for the important ones.
Consensus = several control rooms raising hands until a majority agrees on one decision. The rest can still decide even if a couple are down — but it's correspondingly slow.
A way to get multiple nodes in a distributed system to agree on one value. Majority agreement is called a quorum, and algorithms like Raft and Paxos implement it. Because it's slow, it's reserved for important decisions like leader election, not every decision.
When grown-ups say it
- Consensus
- Several control rooms raising hands to settle on one answer. It leaves everyone with the same decision.
- Quorum
- The majority threshold a decision must clear. Usually means "more than half."
- Leader election
- The vote that picks a new on-call leader. Done the same way as voting on a decision.
- Raft / Paxos
- Names of algorithms that implement consensus in practice. Knowing the names is enough for now.
- Majority
- More than half of the total. This is what fills a quorum.
- Cost of distributed consensus
- The slowness from everyone having to wait. That's why it's not used for urgent decisions.
- Split-brain
- Two sides both insisting they're on call, with no agreement. This is what happens without consensus. → two control rooms each insisting they're the real one
- Replication
- Consensus is also used to pick a new leader when replication needs one. → the same guest log in two warehouses