Goal
State each broadcast guarantee (best-effort, reliable, FIFO, causal, total order, FIFO-total order) as a property of executions, decide for a given space-time diagram which guarantees it satisfies, and prove which guarantees imply which.
A single node in a distributed system often needs to say something to every other node: “I am the leader”, “set x to 5”, “here is the next log entry”. That is a broadcast. The idea looks trivial, but two questions make it subtle. First, if the sender crashes halfway through, do the others still agree on whether the message exists? Second, when several messages are in flight, in which order does each node hand them to its application? Different answers give different broadcast models, and the rest of these notes are, at bottom, about the strongest one: every node delivers the same messages in the same order.
This module fixes the vocabulary. We define the models as properties that an execution either has or lacks, and then prove the “hierarchy” between them: which model implies which, and, for every pair that does not, an explicit execution that separates them. Module 2 gives the algorithms that implement each model, and Module 4 shows why the strongest model is exactly what replicated state machines need.
The module follows lecture 04.03 (Broadcast Protocols, Part 1) and Kleppmann’s notes, Section 4.2, slides 73-80 (1). It assumes the happens-before relation, Lamport clocks and vector clocks from lectures 03.03-04.02 (2).
The system model, briefly
Question. Before we can say what a broadcast guarantees, we need to say what can go wrong. Which failures do we allow, and how do we talk about “before” without a global clock?
Background 1.1 (System model (lectures 02.02 and 03.01)).
- A fixed group of
nodes (processes) ; examples use A, B, C. Each node runs a deterministic program and has a unique id. - Crash-stop failures: a node may halt and never take another step. A node that never crashes in an execution is correct in that execution; the others are faulty. (In crash-recovery a node may restart from stable storage; Raft and Paxos use that model, Modules 5-9.)
- Links are point-to-point. A fair-loss link may drop, delay or reorder messages; retransmitting with sequence numbers turns it into a reliable link: if a correct node sends
to a correct node, the receiver eventually receives exactly once, and nothing is received that was not sent. - Asynchronous timing: no bound on message delay or on the speed of a node. Hence “eventually” in every liveness property below, and no timing guarantee at all.
Time is described by the happens-before relation
For broadcast we look at the execution through the eyes of the application: it sees only its own calls
Definition 1.2 (Delivery notation).For an execution and a node
, let be the set of messages that node delivers. For two messages write In words,
is the order in which node hands messages to its application. The order in which messages arrive at node plays no role in any definition below.
Definition 1.3 (Causal precedence of messages).Message
causally precedes message , written , if there is a chain with in which each step is of one of two kinds:
- program order: the same node broadcasts
and later broadcasts ; or - delivery then broadcast: some node delivers
and later broadcasts . This is Lamport’s happens-before relation applied to the application-level events (broadcasts and deliveries), with the edge
playing the role of “send happens before receive”.
Remark 1.4 (Which happens-before?).Kleppmann’s slide 75 writes
without saying which events count. If we included the network receive events inside the broadcast layer, then a node that has received but is still holding it in a buffer would make every later broadcast causally depend on , although its application has never seen . No algorithm that decides from deliveries alone (such as the causal algorithm of Module 2) could respect that relation. The application can only be influenced by what was delivered to it, so Definition 1.3 uses deliveries. This is also the definition of Hadzilacos and Toueg (3).
Receive versus deliver
Question. Why do the notes keep saying “deliver” instead of “receive”?
Because they are different events at different layers. The broadcast algorithm sits between the network and the application, as in Figure 1.1. It sends and receives messages over point-to-point links; it delivers a message when it hands it up to the application. Between receive and deliver the message may sit in a buffer (a hold-back queue) until the ordering rule allows it out. All ordering guarantees are about the order of deliveries. The network may receive messages in any order it likes; the broadcast algorithm’s job is to repair that order.
Two conventions from lecture 04.03 and Kleppmann matter later:
- A node delivers its own broadcasts. When node
broadcasts , node also delivers (the loopback arrow in Kleppmann’s diagrams). For FIFO and causal broadcast this self-delivery can happen at once; for total order it may have to wait (Figure 1.4). - Broadcast is group communication built from unicast. It is not IP multicast: the algorithm sends one point-to-point message per recipient (or relays through other nodes), so it can add retransmission and ordering on top.
Reliability: best-effort and reliable broadcast
Question. If the sender crashes in the middle of a broadcast, what may the other nodes see?
The weakest guarantee says nothing about that case; the next one says “all or nothing among the correct nodes”.
Definition 1.5 (Best-effort broadcast).An execution satisfies best-effort broadcast (BE) if:
- Integrity (no duplication, no creation): every node delivers each message at most once, and if node
delivers then broadcast , with . - Validity: if a correct node broadcasts
, then every correct node eventually delivers . Kleppmann’s “may drop messages” covers both lossy links and a faulty sender. With reliable links the only loss left is the one that validity permits: a sender that crashes before all its copies have left.
Definition 1.6 (Reliable broadcast).An execution satisfies reliable broadcast (RB) if it satisfies best-effort broadcast and
- Agreement: if a correct node delivers
, then every correct node eventually delivers . It satisfies uniform reliable broadcast if instead
3’. Uniform agreement: if any node delivers
(even one that crashes later), then every correct node eventually delivers .
Agreement is the “atomicity” of lecture 04.04: among the correct nodes, a message is delivered by all of them or by none. Uniform agreement also binds the nodes that crash: a node may not deliver a message, act on it (say, print a receipt), crash, and leave the survivors unaware of it.
Example 1.7 (A sender that crashes mid-broadcast).Node A broadcasts
by sending one copy to B and one to C over reliable links, and delivers to itself. The copy to B leaves; A crashes before the copy to C leaves. Then B delivers and C never does.
- Best-effort broadcast holds: A is faulty, so validity promises nothing, and integrity holds.
- Reliable broadcast fails: B is correct and delivered
, C is correct and did not. This is the first attempt on Kleppmann’s slide 81; the repair (eager reliable broadcast, every node relays what it receives) is in Module 2.
Lecture correction: reliable links are not reliable broadcast
Lecture 04.03 says that “between best-effort broadcast and reliable broadcast, the difference is just using TCP links”. TCP (retransmission and deduplication) removes network losses, but it cannot help when the sender crashes before its last copy leaves: a connection to a dead process carries nothing. Example 1.7 uses perfectly reliable links and still breaks agreement. Lecture 04.04 makes exactly this point and fixes it by relaying.
All the ordered models below are reliable broadcasts with an extra ordering rule. This is Kleppmann’s convention (“all of these are reliable”) and it is what makes “stronger than” a clean statement.
Ordering: FIFO, causal and total order
Question. Given that every correct node eventually gets every message, which orders of delivery should we allow?
Each model below is reliable broadcast plus one safety property about
FIFO order
Definition 1.8 (FIFO broadcast).An execution satisfies FIFO broadcast if it satisfies reliable broadcast and
FIFO order: if the same node broadcasts
and later broadcasts , then every node that delivers has delivered before, that is .
FIFO is a promise per sender: messages from one node come out in the order that node sent them. It says nothing about messages from different senders. Lecture 04.03 explains when that is enough: if a single node (a leader) issues all the commands, then FIFO from that node already makes every follower see the leader’s commands in the leader’s order; messages from other nodes may interleave arbitrarily. The weak spot is a change of leader, when commands from the old and the new leader mix; we return to that in Module 5.
Try it: step through the run and watch node C’s buffer. When m2 arrives before m1, C must hold it; m3 from B is unaffected and is delivered at once. Ask yourself, before each step, which messages C is allowed to deliver.
In Figure 1.2 node C receives
Causal order
Definition 1.9 (Causal broadcast).An execution satisfies causal broadcast if it satisfies reliable broadcast and
Causal order: if
(Definition 1.3), then every node that delivers has delivered before: . If
, nodes may deliver and in either order, and different nodes may choose differently.
Causal order is the guarantee that matches how people read a conversation: a reply must never be shown before the message it replies to. If Alice broadcasts “shall we meet at 2pm?” and Bob, having seen it, broadcasts “yes”, then nobody may see “yes” first. FIFO cannot promise this, because the two messages come from different senders.
Try it: replay the lecture example and compare the delivery logs of A, B and C. They disagree about m2 and m3, which is allowed because the two broadcasts are concurrent; but every node delivers m1 first. Then select m1 and lengthen its delay to C until m2 arrives there first, and watch C hold m2 back.
In Figure 1.3,
Lecture correction: causal order does imply FIFO order
Lecture 04.03, discussing this diagram, says one “might think that [causal broadcast] is strictly stronger than FIFO, but that’s not always the case”, because concurrent messages can be delivered in different orders. The conclusion is wrong; the reason is right but about something else. Causal broadcast is stronger than FIFO broadcast (part 3 of Theorem 1.13, and Example 1.18 shows it is strictly stronger). What causal broadcast does not give is agreement on the order of concurrent messages, so it is not stronger than total order broadcast.
Total order
Definition 1.10 (Total order broadcast).An execution satisfies total order broadcast (TO), also called atomic broadcast, if it satisfies reliable broadcast and
Total order: for all nodes
and messages : if and , then . In words: once any node has delivered
before , no node may deliver without having delivered first.
This is Kleppmann’s “if
Try it: watch node A’s own m3. A broadcasts it, but cannot deliver it to itself until m2 from B has arrived, because the agreed order is m1, m2, m3. Then click messages in the agreed order to move them earlier, and look for an order of the three messages that total order would allow but FIFO-total order would forbid.
Figure 1.4 shows the most surprising consequence, which Kleppmann highlights: a node’s delivery of its own message may have to wait. Under FIFO or causal broadcast a node can deliver its own broadcast immediately (nothing it has not seen can be required to precede it). Under total order, node A broadcast
Combinations
Definition 1.11 (FIFO-total and causal-total order broadcast).An execution satisfies FIFO-total order broadcast if it satisfies both FIFO broadcast and total order broadcast. It satisfies causal-total order broadcast if it satisfies both causal broadcast and total order broadcast.
Kleppmann’s slide 75 lists FIFO-total order as the strongest model. Causal-total order is the model of Hadzilacos and Toueg’s “causal atomic broadcast” (3); we include it because Proposition 1.14 and Example 1.15 show that, once crashes are allowed, it is strictly stronger than FIFO-total order.
Remark 1.12 (Safety and liveness parts).Every model above is a conjunction of two kinds of property.
- Safety (“nothing bad happens”): integrity, FIFO order, causal order, total order. If one is violated, a finite prefix of the execution already shows it: some delivery happened too early or twice.
- Liveness (“something good eventually happens”): validity and agreement. No finite prefix can violate them, because the missing delivery might still come.
The algorithms of Module 2 follow this split: a hold-back buffer enforces the safety part, and a reliable dissemination layer provides the liveness part. For total order the split becomes painful: in an asynchronous system with even one crash, no algorithm can guarantee both parts of fault-tolerant total order broadcast at once (4), which is the subject of Module 4.
Intuition: one question per model
Each model answers one question about two messages
and that a node wants to deliver.
- FIFO: did the same sender send
before ? Then first. - Causal: could the sender of
have known about when it broadcast ? Then first. - Total: has anybody already delivered
before ? Then first, here too. FIFO and causal look backwards along causality, and can be decided locally from metadata the message carries. Total order looks sideways at what other nodes did, and no metadata on
can tell a node that: it must coordinate. That is why the first two are cheap (Module 2) and the last one is consensus (Module 4).
The hierarchy
Question. Kleppmann’s slide 80 draws the models as a diagram with arrows “stronger than”. What exactly does “stronger” mean, and is every arrow (and every missing arrow) justified?
Say that model
Theorem 1.13 (The implications).For every execution:
- reliable broadcast implies best-effort broadcast;
- FIFO, causal and total order broadcast each imply reliable broadcast;
- causal broadcast implies FIFO broadcast;
- FIFO-total order broadcast implies FIFO broadcast and total order broadcast;
- causal-total order broadcast implies causal, FIFO, total order and FIFO-total order broadcast.
Proof
Parts 1, 2 and 4 hold by definition: each model on the left is defined as the model on the right plus further conditions (Definition 1.6, Definition 1.8, Definition 1.9, Definition 1.10, Definition 1.11).
Part 3. Take an execution that satisfies causal broadcast. It satisfies reliable broadcast by definition, so it remains to check FIFO order. Let one node broadcast
and later . By the program-order case of Definition 1.3 (a chain of length one), . Causal order then gives, for every node , , which is exactly FIFO order for this pair. Part 5. Causal-total order is causal plus total order. It implies causal and total order by definition, FIFO by part 3, and therefore FIFO-total order (FIFO and total order together).
The arrow that Kleppmann draws from FIFO-total order to causal broadcast needs an assumption. Without crashes it is true:
Proposition 1.14 (FIFO-total order gives causal order when broadcasters deliver their own messages).Consider an execution that satisfies FIFO-total order broadcast, and in which every node that broadcasts a message also delivers that message (this holds whenever no node crashes, by validity). Then the execution satisfies causal broadcast.
Proof
Reliable broadcast holds by assumption. For causal order, let
via a chain as in Definition 1.3. We prove by induction on the statement Base case,
. There are two kinds of step.
- Program order: the same node broadcasts
and then . FIFO order gives the claim directly. - Delivery then broadcast: some node
delivers and later broadcasts . By assumption also delivers . By integrity, , and precedes at ; hence delivers first: . Now take any node with . Total order (Definition 1.10, with ) gives . Induction step,
. The chain has length and the chain has length . Let deliver . By the base case delivered before ; by the induction hypothesis applied to , it delivered before . So .
The proof used the assumption exactly once, in the delivery-then-broadcast step. When that step’s node crashes before delivering its own message, the argument has nothing to stand on, and indeed the implication fails:
Example 1.15 (FIFO-total order without causal order).Four nodes P, Q, R, S. Node P broadcasts
; only Q receives it, Q delivers , and P crashes. Q then broadcasts ; its copies reach R and S, and Q crashes before delivering itself. R and S deliver .
- Delivery sets:
, (and ). - Reliable broadcast holds: the only correct nodes are R and S, they deliver the same messages, and no correct node broadcast anything.
- FIFO order holds vacuously (no node broadcast two messages), and total order holds vacuously (no node delivers two messages).
- Causal order fails: Q delivered
before broadcasting , so , yet R delivers and never . The execution violates uniform agreement (Q delivered
, the correct nodes never do). Problem 1.5 shows that uniform agreement repairs the implication.
Now the separations: for every pair that Theorem 1.13 does not connect, an execution that satisfies one model and not the other. E1 and E6 use crashes and E2-E5 use none. The separations E2-E5 therefore do not depend on failures, while the separation E6 exists only with crashes: without them every broadcaster delivers its own messages, and FIFO-total order implies causal order (Proposition 1.14).
Proposition 1.16 (Separating executions).Each of the following executions satisfies the first model and violates the second.
Execution (deliveries listed per node, left to right) Satisfies Violates E1 Example 1.7; A crashes after sending to B only BE RB E2 A broadcasts then ; A and C deliver ; B delivers RB FIFO, TO E3 Figure 1.6; C delivers FIFO causal E4 A broadcasts then ; every node delivers TO FIFO E5 Figure 1.3; A, C deliver ; B delivers causal TO E6 Example 1.15 FIFO-TO causal Consequently the implications of Theorem 1.13 are the only ones: causal and total order are incomparable, FIFO and total order are incomparable, every implication in the theorem is strict, and (with crashes) FIFO-total order and causal broadcast are incomparable.
Proof
In E2-E5 no node crashes and every node delivers every message, so validity and agreement hold; integrity holds because each message is delivered once per node, after its broadcast. So each of E2-E5 satisfies reliable broadcast, and we only check the order properties.
- E1 was checked in Example 1.7.
- E2. No two messages from different senders, and no causal chain other than program order at A, so the only constraints are FIFO order for
and the total order between nodes. B delivers before , violating FIFO; A delivers while B delivers without first, violating total order. - E3. FIFO constrains only
, both from A: A, B and C each deliver before . Causal order fails at C, because B delivered before broadcasting (so ) but C delivers first. Details in Example 1.18. - E4. Every node has the same sequence
, so whenever we also have for all : total order holds. FIFO fails since was broadcast first by A. - E5. The causal relations are
and (see the text under Figure 1.3), and every node delivers first: causal order holds. Total order fails because while B delivers without having delivered before it. - E6 was checked in Example 1.15.
For the consequences: E5 shows causal does not imply TO, and E4 shows TO does not imply FIFO, so (by part 3 of the theorem) TO does not imply causal either: the two are incomparable. E5 also satisfies FIFO (part 3) while violating TO, and E4 satisfies TO while violating FIFO: incomparable. Strictness of each implication: E1 (RB over BE), E2 (FIFO and TO over RB), E3 (causal over FIFO), E5 (FIFO-total over FIFO, since E5 is FIFO but not TO), E4 (FIFO-total over TO), E5 again (causal-total over causal), E6 (causal-total over FIFO-total). Finally E6 gives FIFO-total without causal and E5 gives causal without FIFO-total.
Exam trap: total order does not imply FIFO order
The tempting answer “total order is the strongest, so it includes FIFO” is wrong. Total order only demands that all nodes agree; the agreed order may put a sender’s second message before its first (execution E4). Lecture 04.03 gives the practical reason: in a leader-based implementation the leader picks some order, possibly arbitrary, and everyone follows it. FIFO-total order is the model that adds the sender’s order back. The same trap in the other direction: causal broadcast does not give total order (E5).
Lecture correction: total order needs coordination, not vector timestamps
Lecture 04.03 suggests that “anything other than [FIFO], which involves ordering across multiple nodes, needs vector timestamps”, including total order. Vector timestamps are the tool for causal broadcast (Module 2). They cannot produce a total order: two concurrent messages have incomparable vectors, and nothing in the vectors tells two nodes to break the tie the same way. Total order is obtained by agreeing on the order, through a sequencer, through Lamport timestamps plus waiting for every node, or through consensus (Module 2, Module 4). Also, FIFO needs only a per-sender counter, not a Lamport clock (lecture 04.05 says exactly this).
Why total order: replicated state
Question. Why do the later modules care so much about the strongest model?
Remark 1.17 (Total order is what replicas need).Suppose every node keeps a copy of a variable
, and updates are broadcast. Node A broadcasts “set ” and node B concurrently broadcasts “set ”. Under causal broadcast the two are concurrent, so A may apply them in the order 2, 1 and B in the order 1, 2. Both nodes then end with different values ( at A, at B) forever: the replicas have diverged. If instead the updates are delivered by total order broadcast and each node applies them in delivery order, every correct node applies the same sequence of deterministic updates to the same initial state, and ends in the same state. This is state machine replication (5), the subject of Module 4. FIFO-total order adds that each client’s own updates take effect in the order the client issued them.
Weaker models are enough only when updates commute (a counter that is only incremented, a set that only grows): then the order of concurrent updates does not matter and causal broadcast suffices. That route is taken by CRDTs, later in the course and outside these notes.
Worked example: the three lecture diagrams
We check the three executions of lecture 04.03 (Kleppmann slides 76-78) against every model. Each check is a small list of pairs to compare; the method is the same for every exam question of this type:
- List the messages with their senders and the causal relations between them (program order and delivery-then-broadcast, then transitivity).
- For FIFO, compare only pairs with the same sender. For causal, compare only causally related pairs. For total order, compare the delivery sequences of all nodes on their common messages.
Example 1.18 (Lecture 04.03, the FIFO diagram).The execution is Figure 1.6 (Kleppmann slide 76).
Step 1, senders and causality. A broadcasts
and later , so . B delivers and then broadcasts , so . A broadcasts after it has delivered , so as well. Step 2, deliveries. A:
. B: . C: .
Model Pairs to check Holds? FIFO from A: first at A, B, C yes causal : C delivers first no total order A has , C has no So the execution is valid FIFO broadcast but neither causal nor total order. Lecture 04.03 stresses why it is still FIFO: the delay of
to C does not matter for FIFO, because the only constraint is between A’s own messages, and C still delivers before . Which orders could C use? Under FIFO,
may go anywhere relative to A’s pair: , or (the three orders on slide 76). Under causal order all three relations above must hold, and is a chain, so only is allowed; a causal algorithm at C would hold back until arrives.
Example 1.19 (Lecture 04.03, the causal and total order diagrams).The causal diagram (Figure 1.3). Causality:
(B delivered first) and (program order at A). B broadcast before receiving , and A broadcast before receiving , so . Deliveries: A and C have ; B has . FIFO holds (only is constrained), causal holds (everybody starts with ), total order fails ( and swap between A and B). The total order diagram (Figure 1.4). Causality:
, , . Every node delivers . Total order holds (identical sequences), FIFO holds ( before everywhere), causal holds ( first everywhere). So this execution is even causal-total order. Slide 79 shows the other legal choice, at every node; there B must hold back its own .
Exam trap: three more wrong answers
- “Under causal broadcast all nodes deliver concurrent messages in the same order.” No: E5 / Figure 1.3 delivers
in different orders, legally. - “A node need not deliver its own broadcast.” In this model it does (validity applied to a correct sender), and under total order that self-delivery may have to wait for messages from other nodes (Figure 1.4).
- “The receive order shows the delivery order.” Only deliveries count. In Figure 1.2, C receives
before and delivers them the other way round.
What breaks
- Crashes inside a causal chain. The definitions are robust, but intuitions are not: Example 1.15 shows that the familiar arrow “FIFO-total order is stronger than causal” fails once a node can crash right after broadcasting. Uniform agreement, or causal-total order, restores it.
- Crash-recovery. The definitions speak of “correct” nodes that never crash. If a node can restart, it must remember what it has delivered (on stable storage), or it may deliver a message twice or deliver later messages without earlier ones. Raft and Paxos persist their logs for exactly this reason.
- Partitions and timing. Every guarantee here is “eventually”. During a network partition a reliable broadcast simply waits; the models promise nothing about when. In particular they do not promise that a read sees the latest write (that is the topic of quorums in Module 3).
- Byzantine nodes. The models assume nodes follow their program. A malicious sender could send different messages under the same id to different nodes; none of the guarantees survive that without Byzantine-tolerant protocols, which are outside these notes.
Why it matters
The models of this module are the specification side of everything that follows. Module 2 implements reliable, FIFO and causal broadcast without any coordination, and shows that the simple total order algorithms are not fault tolerant. Module 4 uses Remark 1.17 to show that replicated state needs total order broadcast, and that fault-tolerant total order broadcast is the same problem as consensus. Raft (Modules 6-7) and Multi-Paxos (Module 9) are, seen from this module, two implementations of FIFO-total order broadcast that keep working while a minority of nodes crash.
Further reading
- Kleppmann’s notes, Section 4.2 and slides 73-80, for the diagrams this module redraws (1).
- Hadzilacos and Toueg’s survey defines all of these broadcasts formally, including the uniform versions and causal atomic broadcast, and proves the relations between them (3).
- Lamport’s paper introduces happens-before and uses a total order on events to build a replicated state machine (a mutual exclusion example) (2).
- Schneider’s tutorial on the state machine approach explains why replicas need agreement and order (5).
Homework
The problems for this module are in Homework 1.