Consensus, Raft and Gossip
Consensus establishes a replicated decision under explicit majority assumptions; gossip disseminates membership and state but is not consensus.
Consensus, Raft and Gossip
Consensus establishes a replicated decision under explicit majority assumptions; gossip disseminates membership and state but is not consensus. Raft elects a leader for a term, replicates log entries and commits after a majority has stored them under protocol rules. Terms and log matching protect safety across leader changes. Paxos uses proposal and acceptance quorums. Gossip spreads membership or updates; heartbeat timeouts produce suspicion, not proof of death.
Mechanism and worked example
A three-node Raft group can commit when two nodes are available. If only one remains, it cannot safely commit new majority-backed entries. Gossip may temporarily mark a slow but alive node suspect; clients must not equate suspicion with exclusive ownership.
| Mechanism | Role | Boundary |
|---|---|---|
| Raft/Paxos | Agree on replicated decisions | Progress needs quorum |
| Gossip | Disseminate membership | Temporary disagreement |
| Heartbeat | Detect lack of timely response | Timeout does not prove death |
| Fencing token | Reject stale owner | Destination must enforce |
Failure modes and operations
A network partition can isolate a former leader; destination fencing or consensus-backed authority must reject stale writes. Clock pauses and packet delay cause false suspicion. Majority loss stops progress. Unsafe membership changes can threaten quorum safety.
Trade-offs and design boundary
Consensus provides strong coordination but costs network round trips and requires a quorum. Gossip scales dissemination and tolerates temporary disagreement but cannot safely grant exclusive write ownership. Leases reduce coordination only with explicit clock and fencing assumptions.
Interview transfer exercise
For a distributed scheduler, assign ownership through a consensus/lease authority and enforce increasing fencing tokens at the database. Gossip may distribute health but must not act as the lock authority.
Read the diagram
Gossip spreads reachability suspicion → Consensus quorum elects leader → Leader issues increasing epoch → Storage rejects stale epoch writes
For a distributed scheduler, assign ownership through a consensus/lease authority and enforce increasing fencing tokens at the database. Gossip may distribute health but must not act as the lock authority.
Your design draft
Clarify assumptions, explain your approach, and test the difficult cases. Save your draft, then compare it with the study notes.
Self-review checklist
Self-guided practice. Automated AI feedback and code execution are not connected.