Unit 8 of 12 · about 5 hours · derive, implement, measure
Gossip dissemination, a gossip membership implementation and convergence measurement
Gossip trades immediate agreement for eventual convergence at constant per-node cost. It carries membership, and later repair, without any coordinator.
You'll be able to
- Derive per-round growth and rounds-to-cover for a fanout and size, and state the no-duplicate-contact assumption.
- Implement push gossip over a peer list that converges with partitions and heals after them.
- Measure messages per operation and convergence time from a Maelstrom run and compare against the rumor model.
Covers
Read
In this order, only the parts listed
0 of 2 done
- Infection-style disseminationSWIM: Scalable Weakly-consistent Infection-style Process Group Membership (Das et al., 2002)
Section 4.1: piggybacking on ping, ping-req and ack with no extra packets, the bounded buffer, and preferring updates gossiped fewer times
- Broadcast challenges 3a to 3cGossip Glomers - Unique IDs and Broadcast
Challenge 3a (single node), 3b (five nodes, no partitions) and 3c (five nodes with the partition nemesis); the checker tests convergence of every value to every node, not order or recency
Stop at 3c. The 3d and 3e efficiency thresholds belong to their own 25-node setup and are not targets here.
Focus on
- Each round multiplies the informed set: for fanout , assuming every contact reaches a new node. Real contacts repeat, so the model is an upper bound on speed.
- SWIM sends no dedicated gossip packets: membership updates ride the failure-detector traffic. Under overload the buffer keeps younger updates, so fresh changes infect a few members first and the rest once the rate quiets.
- Partitions only delay: challenge 3c passes when every value reaches every node by the end of the run, because re-contact after healing carries the backlog.
- Convergence is the whole contract. Gossip promises nothing about recency, order or durability, so a converged read can still be stale.
Common mistakes · 3
- Quoting the doubling curve as measured behavior. Duplicate contacts and slow nodes stretch every round, so treat the model as the ceiling and your run as the floor.
- Reading convergence as consistency. Two nodes can converge on different values at different times with no violation; ordering needs the clocks from earlier units.
- Gossiping full state every round. The 3b page calls that impractical; send deltas or digests, and keep per-round bytes bounded as the cluster grows.
Try it yourself
Closed-book, before checking anything
Quiz yourself
Answer first, then mark it. Missed ones go to Review.
0 got · 0 missed
1.Fanout 2, ten nodes, one informed. How many rounds to cover all, and what caps the math?Answer
Three: 3, 9, then 27 capped at 10. The cap is the cluster size; extra contacts after cover are duplicates.
2.Why does SWIM prefer younger buffer entries when piggyback space runs out?Answer
Fresh changes must infect someone quickly or they stall everywhere. Once the injection rate quiets, the backlog still propagates through later rounds.
3.A 3c run converges but one read missed a late write. Bug or expected?Answer
Expected. The checker tests convergence by end of run, not recency, so a read may miss a write that had not arrived yet.
4.Your 5-node run converges in 2 seconds. Does gossip guarantee 2-second convergence at 50 nodes?Answer
No. Rounds grow slowly but per-round work, duplicates and the partition schedule all change; remeasure on the new setup.
Practice
- Gossip Glomers 3a to 3c: Broadcast
Run 3a with one node, 3b with five nodes, and 3c with five nodes plus the partition nemesis, at rate 10 for 20 seconds, as
./maelstrom test -w broadcast --bin ~/go/bin/maelstrom-broadcast --node-count 5 --time-limit 20 --rate 10 --nemesis partitionadjusted per challenge; keep every run directoryThe command quotes the page's Go binary path; point it at your own binary. Read messages-per-operation and stable latencies from your own 3c results file as a labeled example, and compare convergence rounds with the rumor model.
- Simulate Gossip Rumor Spread
Implement
spreadwithinformed = min(n, informed * (1 + fanout))per round, capping late rounds atn; the examples cover doubling and the 27-to-10 capDo this before the cluster runs. It fixes the ceiling your measured spread must sit under.
You're done when
The rumor examples pass from memory, 3c passes with its run directory kept, and you can explain your measured rounds as model ceiling plus duplicates.
Only when you can do this without notes.
Leads to
Notes
Resources · 2 for this unit, 12 more in the section
- SWIM: Scalable Weakly-consistent Infection-style Process Group Membership (Das et al., 2002)Cornell University · support
Read the direct and indirect probing detector, infection-style dissemination, the suspicion mechanism and incarnation numbers. Suspicion timeouts depend on the workload.
- Gossip Glomers - Unique IDs and BroadcastFly.io and Jepsen · required
Each challenge runs locally under Maelstrom (v0.2.4; the pages were tested on 0.2.3) with its checker and, where the page says so, the partition nemesis; keep the run directory as the history. Do challenge 2 (unique IDs under partition with total availability) and 3a to 3c (broadcast, then with partitions). A pass shows uniqueness or convergence in that run, not ordering or recency.
Also in this section
- DDIA 2e - Chapter 9 The Trouble with Distributed SystemsMartin Kleppmann and Chris Riccomini · primary
Read clocks, pauses, unreliable networks, partial failures and knowledge limits. For each failure, record what a node observes, what is true globally and what action is safe under that uncertainty.
- Time, Clocks, and the Ordering of Events in a Distributed System (Lamport, 1978)Leslie Lamport · required
Read the partial ordering and logical clocks sections: happens-before, the Clock Condition, rules IR1 and IR2, and the total order. Its ties are broken arbitrarily, so the total order is not causality.
- Logical Physical Clocks and Consistent Snapshots (Kulkarni et al., 2014)University at Buffalo · support
Read the hybrid logical clock algorithm and its bounds; the paper reports the logical counter staying well below its proved bound in practice, so measure your own.
- The phi Accrual Failure Detector (Hayashibara et al., 2004)JAIST · support
Read how phi is computed from the heartbeat inter-arrival history and how a threshold trades detection time for false suspicion. Its normal approximation misleads under bursty delay, so test with pause traces too.
- How to Do Distributed Locking (Kleppmann, 2016)Martin Kleppmann · required
Read the process-pause, network-delay and fencing-token sections with DDIA 2e Chapter 9 "Distributed Locks and Leases". Treat the Redlock critique as dated to 2016; the lasting lesson is that the storage service must reject a write that carries an older token.
- Cambridge Concurrent and Distributed Systems Notes (Kleppmann) - Time, Clocks and OrderingUniversity of Cambridge (Martin Kleppmann) · support
Use Chapter 3 (physical clocks, NTP and monotonic clocks, happens-before) and Section 4.1 (Lamport and vector clocks with worked examples) as the derivation workbook: work Exercises 7 to 13. Each section marks where its public lecture video starts.
- Building Distributed Systems - The TimekeeperBuild Distributed Systems · optional
Only the first three tasks are free (clock reads and backward jumps, a monotonic wrapper, a split-brain lease). Tasks are graded in the browser after login, so treat a pass as a drill and keep your local harness as the evidence.
- Building Distributed Systems - The GossiperBuild Distributed Systems · optional
Only the first three tasks are free (basic broadcast, tree topology, random gossip). Tasks are graded in the browser after login, so treat a pass as a drill and keep your local harness as the evidence.
- HLD Handbook - Clocks, Failure Detection and Consistent HashingHLD Handbook · required
Read Part 3 clocks and ordering, failure detection and consistent hashing. Use its exercises to compare assumptions, then verify claims against your own histories.
- MIT 6.5840 - Failure and Paper Discussion LensMIT PDOS · support
Use the RPC, GFS, Raft and consistency lectures to identify which timing assumptions affect progress and which invariants must not depend on time. Do not start the Raft lab yet.
- Replicated Log and Stream Processor - Time and Membership SliceRoadmap-Final · support
Add incarnation IDs, logical timestamps, gossip membership, suspicion metrics and fenced ownership. Retain seeds and minimized traces for every false-failure or stale-actor case.
- AlgoMaster System Design practice - clock, gossip and lease drillsAlgoMaster · support
Use only the named problems: Advance a Lamport Logical Clock, Compare Two Vector Clocks, Update a Vector Clock on Receive, Advance a Hybrid Logical Clock, Simulate Gossip Rumor Spread and Implement a Lease Lock with Fencing Tokens. Each states its function signature and checks small deterministic cases.