SlideShare a Scribd company logo
Gossip protocol and applications
Tu Nguyen
Staff Software Engineer - Axon
Gossip protocol
Grokking Techtalk #39: Gossip protocol and applications
Gossip in computer science
A peer-to-peer communication protocol●
Inspired by epidemics, human gossip and social networks (spreading rumors)●
epidemic protocol (synonym)■
why ?■
rumors or epidemics in society travel at a great speed and reach to almost every member of the community
without needing a central coordinator.
●
Gossip was founded originally to solve Multicast problem●
Multicast●
we want to communicate a message to all the nodes in the network■
each node sends the message to only a few of the nodes■
Multicast problems ?●
Fault-tolerance: node might crash, packet might be dropped, etc○
Scalability: millions, hundreds of millions of nodes○
Centralized: single sender “multi-cast” TCP/UDP packets to others.○
Tree-based multicast: too much redundancy with ACK/NACK msg.○
Multicast was originally heavily used in network devices (eg. routers); how to leverage it in application layer ?○
Gossip basic
A node wants to share some information to the other nodes in the network. Then periodically it
selects randomly a node from the set of nodes and exchanges the information. The node that
receives the information does exactly the same thing.
Cycle●
number of rounds to spread the information■
Fanout●
number of nodes that a node “gossip” within each cycle■
Gossip properties
Node selection must be random (or guarantee enough peer diversity)●
Node only stores local information. There is no shared global state.●
Communication is round-based (periodic).●
Transmission and processing capacity per round is limited.●
All nodes run the same protocol.●
Not deterministic (because of randomness peer sampling).●
Advantages of Gossip
Scalable●
Fault-tolerance●
Robust●
Decentralized●
Convergent consistency●
Gossip modeling
Consider a distributed network where nodes are message-passing to each
other.
State of a node●
Susceptible - node has not received update yet (is not infected).■
Infected - node with an update it is willing to share.■
Removed - node has received the update but is not willing to share.■
Two basic models●
SI (anti-entropy)■
SIR (rumor-mongering)■
When R state happens ?
👉 Many algorithms. One of them are counting for redundant messages.
Gossip modeling
Push / Pull / Push-Pull●
Push■
I nodes are the ones sending/infecting S nodes●
efficient when there are a few updates.●
Pull■
all nodes are actively pulling for updates●
efficient when there are many updates.●
Push-Pull■
node pushes when it has updates and also pulls for new updates●
node and selected node are exchanging information ●
Gossip modeling
https://flopezluis.github.io/gossip-simulator/
Gossip Applications
Applications
Cluster membership●
Information dissemination●
Failure detection●
Database replication●
Overlay network●
Aggregations●
Cluster Membership
 Who are my live peers ?
Desired properties
Connectedness●
Balance●
Short path-length●
Reducing redundancy●
Scalability●
Accuracy●
Full Partial
Full Partial
👍 Connectedness
👍 Short-path length
👌 Accuracy
👌 Balance
👎 High redundancy
👎 Low scalability
👌 Connectedness
👌 Short-path length
👌 Accuracy
👌 Balance
👍 Low redundancy
👍 High scalability
Cluster Membership
✅
SWIM - Cornell University 2002●
SCAMP - Microsoft Research 2003●
CYCLON - Vrije University, The Netherlands, 2005●
HYPARVIEW - University of Lisbon, 2007●
Cluster Membership
SWIM - Cornell university (2002)
Scalable Weakly-consistent Infection-style Process Group
Membership
https://www.cs.cornell.edu/projects/Quicksilver/public_pdfs/SWIM.pdf
Properties
Scalable●
Weakly consistent●
Infection-style●
Membership protocol●
SWIM
Motivated by traditional heart-beating●
every interval T, notify peers of liveness■
if no update received from peer P after T * limit, mark P as dead.■
heart-beat = membership + failure detection■
Heart-beat is doing good at:●
completeness - yes!■
strong completeness - every crashed node is eventually detected by all correct
nodes.
●
Accuracy - high!■
Heart-beat problems ?●
Network load: N^2■
SWIM is trying to ...
Separate two problems and solve them one-by-one●
Failure detection (👉 “live” peers)○
Membership protocol (👉 list of peers)○
Optimization●
Reduce network load○
Failure detection○
decrease processing time●
increase accuracy●
Failure Detection properties
One step back...●
The two properties of a distributed system□
Safety - nothing bad ever happens○
Liveness - something good eventually happens.○
Failure Detection properties●
Completeness (L) - failure detector would find the node(s) that finally crashed in the
system. 
□
Accuracy (S) - correct decisions that the failure detector has made in a node.□
Failure Detection properties
Degree of completeness●
depends on number of crashed nodes is suspected by a failure detector in a certain
period
□
Strong completeness - every faulty node is eventually permanently suspected by every non-
faulty node
○
Weak completeness - every faulty node is eventually permanently suspected by some non-faulty
node
○
Degree of accuracy●
depends on number of mistakes that a failure detector made in certain period□
Strong accuracy - no node is suspected (by any node) before it crashes○
Weak accuracy - some non-faulty node is never suspected○
Eventual strong accuracy - after some time, system becomes strong accuracy.○
Eventual weak accuracy - after some time, system becomes weak accuracy.○
SWIM Failure Detection
Each node in set of N node●
Choose a random peer○
Ping - ACK□
Indirect Ping (iff no ACK)○
Choose k random peers□
indirect Ping○
Evaluation:
completeness: every nodes will be pinged!●
accuracy: “high” (🔍)●
speed of detection: 1 * Interval●
network load: (4*k + 2) * N ~ 0(N)●
SWIM Membership Protocol
Aware of join / leave nodes●
Motivated by Gossip●
Piggy-back approach■
Infection-style○
ping is sent to random peer□
eventually (weakly) consistent□
updates send peer-to-peer□
SWIM - Optimization
Suspicion state - to improve accuracy
Trade-off between failure detection time and false positives.●
Introduce suspicion state.●
A 👉 B: Ping! Suspect C failed■
B 👉 A: ACK!■
A few moment later■
A, B 👉 C: Ping! Are you dead ?□
C 👉 A,B: ACK! (i’m not 😋)□
State FSM
SWIM - Optimization
Round-robin probe peer selection
Randomly sort peer set■
Ping in round-robin order■
Evaluation:
Completeness: increase, time-bounded○
State FSM
SWIM - Limitations
Node leave vs fail●
Re-joining●
Event ordering●
Message encryption●
Peer metadata●
Custom payload●
Network participants●
More details:  https://www.cs.cornell.edu/projects/Quicksilver/public_pdfs/SWIM.pdf
SWIM - Implementation
memberlist https://github.com/hashicorp/memberlist●
serf, consul, etcd are relying on swim-based memberlist for failure detection and group
membership.
●
Other “announced” applications
Cassandra internal - understand gossip https://www.youtube.com/watch?v=FuP1Fvrv6ZQ●
AWS S3 gossip http://status.aws.amazon.com/s3-20080720.html●
Slicing structured overlay network
T-MAN  https://www.researchgate.net/publication/225403352_T-Man_Gossip-
Based_Overlay_Topology_Management
●
https://managementfromscratch.wordpress.com/2016/04/01/introduction-to-gossip●

More Related Content

PPTX
Distributed Transaction in Microservice
PDF
Introduction to High-Performance Computing
PPT
User authentication crytography in cse engineering
PPT
File replication
PDF
Grokking Techtalk #39: How to build an event driven architecture with Kafka ...
PPT
distributed shared memory
DOC
Distributed Mutual exclusion algorithms
PPTX
Message and Stream Oriented Communication
Distributed Transaction in Microservice
Introduction to High-Performance Computing
User authentication crytography in cse engineering
File replication
Grokking Techtalk #39: How to build an event driven architecture with Kafka ...
distributed shared memory
Distributed Mutual exclusion algorithms
Message and Stream Oriented Communication

What's hot (20)

PPTX
2 vm provisioning
PDF
PPTX
Message passing in Distributed Computing Systems
PPT
Sequential consistency model
PDF
Deadlock in Distributed Systems
PPT
Synchronization in distributed systems
PDF
High Concurrency Architecture at TIKI
PDF
Grokking Techtalk #34: K8S On-premise: Incident & Lesson Learned ZaloPay Mer...
PDF
PPT
Process Management-Process Migration
PDF
Grokking TechTalk #33: High Concurrency Architecture at TIKI
PPTX
Advanced nGrinder 2nd Edition
PPTX
Slide Báo Cáo Đồ Án Tốt Nghiệp CNTT
PDF
Domain Driven Design và Event Driven Architecture
PPT
Aspect Oriented Software Development
PPT
Naming in Distributed Systems
PPT
Chapter 4 a interprocess communication
PPTX
Software architecture for high traffic website
DOC
Naming in Distributed System
2 vm provisioning
Message passing in Distributed Computing Systems
Sequential consistency model
Deadlock in Distributed Systems
Synchronization in distributed systems
High Concurrency Architecture at TIKI
Grokking Techtalk #34: K8S On-premise: Incident & Lesson Learned ZaloPay Mer...
Process Management-Process Migration
Grokking TechTalk #33: High Concurrency Architecture at TIKI
Advanced nGrinder 2nd Edition
Slide Báo Cáo Đồ Án Tốt Nghiệp CNTT
Domain Driven Design và Event Driven Architecture
Aspect Oriented Software Development
Naming in Distributed Systems
Chapter 4 a interprocess communication
Software architecture for high traffic website
Naming in Distributed System
Ad

Similar to Grokking Techtalk #39: Gossip protocol and applications (20)

PDF
Is there anybody out there? Reactive Systems Hamburg
PDF
Desert Code Camp 2016.1 - Stateful Distributed Systems
PDF
KEY CONCEPTS FOR SCALABLE STATEFUL SERVICES
PDF
Is there anybody out there?
PDF
London HUG 15/8/17 - Lifeguard
PDF
Is there anybody out there? Scala Days Berlin 2018
PPTX
L6.FA16hhhhsjjjhkjhkjhkjhjjjhjhkjjk.pptx
PPTX
List_of_cmpknowledgeofcmputerbscmsc.pptx
PDF
Is there anybody out there?
PDF
Gossip-based algorithms
PDF
Sistemas Distribuidos
PPT
9 fault-tolerance
PPT
Distributed Streams
PPTX
Wsn state-centric programming
PDF
Enter Gossipsub, A scalable, extensible & hardened P2P PubSub Router protocol
PDF
Move Message Passing Interface Applications to the Next Level
PDF
dist_systems.pdf
PDF
From Mainframe to Microservice: An Introduction to Distributed Systems
PDF
Building secure and_reliable_network_applications
DOCX
Wireless sensor network
Is there anybody out there? Reactive Systems Hamburg
Desert Code Camp 2016.1 - Stateful Distributed Systems
KEY CONCEPTS FOR SCALABLE STATEFUL SERVICES
Is there anybody out there?
London HUG 15/8/17 - Lifeguard
Is there anybody out there? Scala Days Berlin 2018
L6.FA16hhhhsjjjhkjhkjhkjhjjjhjhkjjk.pptx
List_of_cmpknowledgeofcmputerbscmsc.pptx
Is there anybody out there?
Gossip-based algorithms
Sistemas Distribuidos
9 fault-tolerance
Distributed Streams
Wsn state-centric programming
Enter Gossipsub, A scalable, extensible & hardened P2P PubSub Router protocol
Move Message Passing Interface Applications to the Next Level
dist_systems.pdf
From Mainframe to Microservice: An Introduction to Distributed Systems
Building secure and_reliable_network_applications
Wireless sensor network
Ad

More from Grokking VN (20)

PDF
Grokking Techtalk #46: Lessons from years hacking and defending Vietnamese banks
PDF
Grokking Techtalk #45: First Principles Thinking
PDF
Grokking Techtalk #42: Engineering challenges on building data platform for M...
PDF
Grokking Techtalk #43: Payment gateway demystified
PPTX
Grokking Techtalk #40: Consistency and Availability tradeoff in database cluster
PPTX
Grokking Techtalk #40: AWS’s philosophy on designing MLOps platform
PDF
Grokking Techtalk #38: Escape Analysis in Go compiler
PPTX
Grokking Techtalk #37: Data intensive problem
PPTX
Grokking Techtalk #37: Software design and refactoring
PDF
Grokking TechTalk #35: Efficient spellchecking
PDF
Grokking TechTalk #33: Architecture of AI-First Systems - Engineering for Big...
PDF
SOLID & Design Patterns
PDF
Grokking TechTalk #31: Asynchronous Communications
PDF
Grokking TechTalk #30: From App to Ecosystem: Lessons Learned at Scale
PDF
Grokking TechTalk #29: Building Realtime Metrics Platform at LinkedIn
PDF
Grokking TechTalk #27: Optimal Binary Search Tree
PDF
Grokking TechTalk #26: Kotlin, Understand the Magic
PDF
Grokking TechTalk #26: Compare ios and android platform
PPTX
Grokking TechTalk #24: Thiết kế hệ thống Background Job Queue bằng Ruby & Pos...
PDF
Grokking TechTalk #24: Kafka's principles and protocols
Grokking Techtalk #46: Lessons from years hacking and defending Vietnamese banks
Grokking Techtalk #45: First Principles Thinking
Grokking Techtalk #42: Engineering challenges on building data platform for M...
Grokking Techtalk #43: Payment gateway demystified
Grokking Techtalk #40: Consistency and Availability tradeoff in database cluster
Grokking Techtalk #40: AWS’s philosophy on designing MLOps platform
Grokking Techtalk #38: Escape Analysis in Go compiler
Grokking Techtalk #37: Data intensive problem
Grokking Techtalk #37: Software design and refactoring
Grokking TechTalk #35: Efficient spellchecking
Grokking TechTalk #33: Architecture of AI-First Systems - Engineering for Big...
SOLID & Design Patterns
Grokking TechTalk #31: Asynchronous Communications
Grokking TechTalk #30: From App to Ecosystem: Lessons Learned at Scale
Grokking TechTalk #29: Building Realtime Metrics Platform at LinkedIn
Grokking TechTalk #27: Optimal Binary Search Tree
Grokking TechTalk #26: Kotlin, Understand the Magic
Grokking TechTalk #26: Compare ios and android platform
Grokking TechTalk #24: Thiết kế hệ thống Background Job Queue bằng Ruby & Pos...
Grokking TechTalk #24: Kafka's principles and protocols

Recently uploaded (20)

PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PDF
Structs to JSON How Go Powers REST APIs.pdf
PPTX
Sustainable Sites - Green Building Construction
PPTX
Strings in CPP - Strings in C++ are sequences of characters used to store and...
PDF
Arduino robotics embedded978-1-4302-3184-4.pdf
PPTX
CH1 Production IntroductoryConcepts.pptx
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
Geodesy 1.pptx...............................................
PPTX
Lesson 3_Tessellation.pptx finite Mathematics
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PDF
PPT on Performance Review to get promotions
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
Internet of Things (IOT) - A guide to understanding
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Structs to JSON How Go Powers REST APIs.pdf
Sustainable Sites - Green Building Construction
Strings in CPP - Strings in C++ are sequences of characters used to store and...
Arduino robotics embedded978-1-4302-3184-4.pdf
CH1 Production IntroductoryConcepts.pptx
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
Operating System & Kernel Study Guide-1 - converted.pdf
Geodesy 1.pptx...............................................
Lesson 3_Tessellation.pptx finite Mathematics
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
CYBER-CRIMES AND SECURITY A guide to understanding
PPT on Performance Review to get promotions
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
Model Code of Practice - Construction Work - 21102022 .pdf
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
Internet of Things (IOT) - A guide to understanding

Grokking Techtalk #39: Gossip protocol and applications

  • 1. Gossip protocol and applications Tu Nguyen Staff Software Engineer - Axon
  • 4. Gossip in computer science A peer-to-peer communication protocol● Inspired by epidemics, human gossip and social networks (spreading rumors)● epidemic protocol (synonym)■ why ?■ rumors or epidemics in society travel at a great speed and reach to almost every member of the community without needing a central coordinator. ● Gossip was founded originally to solve Multicast problem● Multicast● we want to communicate a message to all the nodes in the network■ each node sends the message to only a few of the nodes■ Multicast problems ?● Fault-tolerance: node might crash, packet might be dropped, etc○ Scalability: millions, hundreds of millions of nodes○ Centralized: single sender “multi-cast” TCP/UDP packets to others.○ Tree-based multicast: too much redundancy with ACK/NACK msg.○ Multicast was originally heavily used in network devices (eg. routers); how to leverage it in application layer ?○
  • 5. Gossip basic A node wants to share some information to the other nodes in the network. Then periodically it selects randomly a node from the set of nodes and exchanges the information. The node that receives the information does exactly the same thing. Cycle● number of rounds to spread the information■ Fanout● number of nodes that a node “gossip” within each cycle■
  • 6. Gossip properties Node selection must be random (or guarantee enough peer diversity)● Node only stores local information. There is no shared global state.● Communication is round-based (periodic).● Transmission and processing capacity per round is limited.● All nodes run the same protocol.● Not deterministic (because of randomness peer sampling).●
  • 8. Gossip modeling Consider a distributed network where nodes are message-passing to each other. State of a node● Susceptible - node has not received update yet (is not infected).■ Infected - node with an update it is willing to share.■ Removed - node has received the update but is not willing to share.■ Two basic models● SI (anti-entropy)■ SIR (rumor-mongering)■ When R state happens ? 👉 Many algorithms. One of them are counting for redundant messages.
  • 9. Gossip modeling Push / Pull / Push-Pull● Push■ I nodes are the ones sending/infecting S nodes● efficient when there are a few updates.● Pull■ all nodes are actively pulling for updates● efficient when there are many updates.● Push-Pull■ node pushes when it has updates and also pulls for new updates● node and selected node are exchanging information ●
  • 13. Applications Cluster membership● Information dissemination● Failure detection● Database replication● Overlay network● Aggregations●
  • 14. Cluster Membership  Who are my live peers ? Desired properties Connectedness● Balance● Short path-length● Reducing redundancy● Scalability● Accuracy● Full Partial
  • 15. Full Partial 👍 Connectedness 👍 Short-path length 👌 Accuracy 👌 Balance 👎 High redundancy 👎 Low scalability 👌 Connectedness 👌 Short-path length 👌 Accuracy 👌 Balance 👍 Low redundancy 👍 High scalability Cluster Membership ✅
  • 16. SWIM - Cornell University 2002● SCAMP - Microsoft Research 2003● CYCLON - Vrije University, The Netherlands, 2005● HYPARVIEW - University of Lisbon, 2007● Cluster Membership
  • 17. SWIM - Cornell university (2002) Scalable Weakly-consistent Infection-style Process Group Membership https://www.cs.cornell.edu/projects/Quicksilver/public_pdfs/SWIM.pdf Properties Scalable● Weakly consistent● Infection-style● Membership protocol●
  • 18. SWIM Motivated by traditional heart-beating● every interval T, notify peers of liveness■ if no update received from peer P after T * limit, mark P as dead.■ heart-beat = membership + failure detection■ Heart-beat is doing good at:● completeness - yes!■ strong completeness - every crashed node is eventually detected by all correct nodes. ● Accuracy - high!■ Heart-beat problems ?● Network load: N^2■
  • 19. SWIM is trying to ... Separate two problems and solve them one-by-one● Failure detection (👉 “live” peers)○ Membership protocol (👉 list of peers)○ Optimization● Reduce network load○ Failure detection○ decrease processing time● increase accuracy●
  • 20. Failure Detection properties One step back...● The two properties of a distributed system□ Safety - nothing bad ever happens○ Liveness - something good eventually happens.○ Failure Detection properties● Completeness (L) - failure detector would find the node(s) that finally crashed in the system.  □ Accuracy (S) - correct decisions that the failure detector has made in a node.□
  • 21. Failure Detection properties Degree of completeness● depends on number of crashed nodes is suspected by a failure detector in a certain period □ Strong completeness - every faulty node is eventually permanently suspected by every non- faulty node ○ Weak completeness - every faulty node is eventually permanently suspected by some non-faulty node ○ Degree of accuracy● depends on number of mistakes that a failure detector made in certain period□ Strong accuracy - no node is suspected (by any node) before it crashes○ Weak accuracy - some non-faulty node is never suspected○ Eventual strong accuracy - after some time, system becomes strong accuracy.○ Eventual weak accuracy - after some time, system becomes weak accuracy.○
  • 22. SWIM Failure Detection Each node in set of N node● Choose a random peer○ Ping - ACK□ Indirect Ping (iff no ACK)○ Choose k random peers□ indirect Ping○ Evaluation: completeness: every nodes will be pinged!● accuracy: “high” (🔍)● speed of detection: 1 * Interval● network load: (4*k + 2) * N ~ 0(N)●
  • 23. SWIM Membership Protocol Aware of join / leave nodes● Motivated by Gossip● Piggy-back approach■ Infection-style○ ping is sent to random peer□ eventually (weakly) consistent□ updates send peer-to-peer□
  • 24. SWIM - Optimization Suspicion state - to improve accuracy Trade-off between failure detection time and false positives.● Introduce suspicion state.● A 👉 B: Ping! Suspect C failed■ B 👉 A: ACK!■ A few moment later■ A, B 👉 C: Ping! Are you dead ?□ C 👉 A,B: ACK! (i’m not 😋)□ State FSM
  • 25. SWIM - Optimization Round-robin probe peer selection Randomly sort peer set■ Ping in round-robin order■ Evaluation: Completeness: increase, time-bounded○ State FSM
  • 26. SWIM - Limitations Node leave vs fail● Re-joining● Event ordering● Message encryption● Peer metadata● Custom payload● Network participants● More details:  https://www.cs.cornell.edu/projects/Quicksilver/public_pdfs/SWIM.pdf
  • 27. SWIM - Implementation memberlist https://github.com/hashicorp/memberlist● serf, consul, etcd are relying on swim-based memberlist for failure detection and group membership. ●
  • 28. Other “announced” applications Cassandra internal - understand gossip https://www.youtube.com/watch?v=FuP1Fvrv6ZQ● AWS S3 gossip http://status.aws.amazon.com/s3-20080720.html● Slicing structured overlay network T-MAN  https://www.researchgate.net/publication/225403352_T-Man_Gossip- Based_Overlay_Topology_Management ● https://managementfromscratch.wordpress.com/2016/04/01/introduction-to-gossip●