Consensus is agreeing on one value when any machine may crash and the network may lie
Martin Kleppmann · Distributed Systems 6.1: Consensus
The idea
Several machines need to agree on a single value, the next entry in a log, which node is the leader, whether a transaction committed. Any of them may crash, and the network may delay or drop messages so that a live node is indistinguishable from a dead one. Kleppmann's lecture shows that consensus and total order broadcast are the same problem in different clothes, then sets out the system models under which it can be solved at all. The protocols you have heard of, Raft and Paxos, are solutions under particular assumptions, and knowing the assumptions is what lets you say when a system's guarantee holds.
Ask what a consensus protocol assumes about crashes and the network; its guarantee is only as strong as those assumptions.
When it works
Distributed systems interviews, database replication questions, and any design that claims strong consistency across machines.
When it may fail
Consensus is slow and expensive, and many systems deliberately avoid it by accepting weaker guarantees. Knowing when not to need it is as much the skill as knowing how it works.
How to use it
When a design uses a leader, say how the leader is chosen, what happens when it is partitioned from the others, and whether two leaders can exist at once. Those three questions are the consensus problem in interview form.
Where it came from
Video Distributed Systems 6.1: Consensus · Martin Kleppmann (Cambridge)
What the source says. Kleppmann shows that consensus and total order broadcast are equivalent problems, then sets out the system models under which consensus can be solved.
Connected ideas
Says something similar
In a distributed system every request may arrive twice, so make the second one harmlessDesign every retryable operation so that doing it twice has the same effect as doing it once; the network will test this for you.
Says something similar
An index turns a table scan into a handful of page reads, paid for in write speed and diskAn index buys read speed with write speed and disk; add one for the query you run most and remove the ones you never use.
Concepts
Put it to work on L3VLUP
More like this
- FrameworkSoftware engineeringBook
Complexity is what you must hold in your head to make a safe change
Judge a design by how much a reader must understand to change it safely, and prefer deep modules behind small interfaces.
From A Philosophy of Software Design · John Ousterhout
- ArgumentSoftware engineeringBook
Speed and stability rise together. The trade-off is the myth
The practices that make shipping frequent are the ones that make it safe, so do not trade one for the other.
From Accelerate · Nicole Forsgren, Jez Humble and Gene Kim
- FrameworkArtificial intelligenceVideo located
The context window is not the constraint people think it is; attention across it is
A long window degrades before it fills; curate and order what goes in rather than relying on size.
From Why LLMs Get Dumb (Context Windows Explained) · NetworkChuck
- TechniqueSoftware engineeringVideo located
In dynamic programming the hard part is finding the subproblem, not the memoisation
Find the subproblem and the recurrence first; the implementation is mechanical once the structure is clear.
From 5 Simple Steps for Solving Dynamic Programming Problems · Reducible