Consensus and Strong Consistency
What You'll Learn
You'll learn why achieving strong consistency in distributed systems typically requires consensus protocols like Paxos or Raft.
The Core Problem
In previous lessons, you learned what strong consistency is—ensuring all nodes agree on the same value at the same time. But how do distributed nodes actually achieve that agreement when they're separated by networks that can fail, reorder messages, or partition?
This is where consensus comes in. Consensus is the process by which multiple nodes agree on a single value or order of operations, even in the face of failures. Without consensus, you cannot guarantee strong consistency across replicas.
Why Consensus is Essential
Imagine three database replicas receiving writes independently. Without coordination, each might accept different updates in different orders. When a client reads, which version is "correct"? Consensus protocols solve this by ensuring all replicas agree on:
- Which operations happened
- In what order they occurred
- Before acknowledging the write to clients
Protocols like Paxos and Raft are battle-tested algorithms that provide this agreement. They ensure that even if some nodes fail or messages are delayed, the surviving nodes will converge on the same decision—making linearizability and strict serializability possible.
The Tradeoff
Consensus is powerful but expensive. Nodes must communicate and wait for a majority to agree before proceeding. This coordination adds latency and reduces availability during partitions—exactly the tradeoffs you explored in CAP and PACELC. That's why strongly consistent systems often feel slower: they're running consensus behind the scenes.
Key Takeaway:
Strong consistency requires distributed agreement, which is solved by consensus protocols like Paxos and Raft—but this coordination comes at the cost of increased latency and reduced availability during failures.