AdvancedTopic 82 of 104Software & Computing
Consensus algorithms
Paxos and Raft let nodes agree despite failures.
In depth
Consensus lets nodes agree on a value despite failures: Paxos, Raft (leader election, log replication), and Byzantine fault tolerant protocols (PBFT, blockchain). Used for configuration stores (etcd, ZooKeeper), distributed databases and coordination. Needs a majority quorum.
Key points
- Leaders and terms
- Safety vs liveness
- FLP impossibility
Exampleetcd uses Raft to keep Kubernetes cluster state consistent.
What is Consensus algorithms?
Paxos and Raft let nodes agree despite failures.
Why is it important to understand consensus algorithms?
Consensus algorithms let a group of nodes agree on a value or log despite failures, which is needed for reliable replicated systems.
What does Raft do?
It elects a leader, which replicates a log of commands to followers, and a majority agreement commits each entry.
Why do consensus algorithms need a majority?
Two majorities always overlap, so any decision made by a majority includes at least one node that knows the previous decision.
How is Consensus algorithms used in practice?
Typical applications include electing a leader for a cluster of database nodes, keeping a replicated configuration consistent across servers and ensuring all nodes apply the same sequence of commands in a distributed store.
What should I learn before Consensus algorithms?
Study "Distributed systems" first (topic 81 of 104 in Software & Computing). It covers the groundwork this topic builds on.
What are the key points of Consensus algorithms?
Leaders and terms. Safety vs liveness. FLP impossibility.
Can you give an example of Consensus algorithms?
etcd uses Raft to keep Kubernetes cluster state consistent.
What comes after Consensus algorithms?
The next topic is "Caching and load balancing", which builds directly on this one.
How difficult is Consensus algorithms?
It is classed as Advanced in Software & Computing (topic 82 of 104). It is an advanced topic. It assumes you are comfortable with the intermediate topics in Software & Computing.