Gossip protocols for large-scale distributed...

205
© Alberto Montresor 1 Gossip protocols for large-scale distributed systems Alberto Montresor

Transcript of Gossip protocols for large-scale distributed...

Page 1: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 1

Gossip protocols for large-scale distributed systems

Alberto Montresor

Page 2: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

University of Trento

2

Page 3: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 3

Page 4: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 4

Gossip definition

✦ In a recent workshop on the future of gossip✦ many attempts to formally define gossip✦ we failed!

✦ either too broad✦ or too strict

✦ Gossip best described with a prototypical gossip scheme✦ “I cannot define gossip, but I can recognize it when I see it”

Page 5: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 5

A generic gossip protocol - executed by process p

do once every δ time units q = getPeer(state) sp = prepareMsg(state, q) send (REQ, sp, p) to q

do forever receive (t, sq, q) from * if ( t = REQ ) then sp = prepareMsg(state, q) send (REP, sp, p) to q state = update(state, sq)

A "cycle" of length δ

Init: initialize my local state

Active thread Passive thread

Page 6: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

Epidemic cycle

✦ During a cycle of length δ, every node has the possibility of contacting one random node

6

Page 7: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 7

A generic gossip protocol

✦ Generic scheme is... too generic!

✦ Gossip “rules of thumb”✦ peer selection must be random, or at least guarantee enough peer diversity✦ only local information is available at all nodes

✦ communication is round-based (periodic)✦ transmission and processing capacity per round is limited

✦ all nodes run the same protocol

Page 8: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 8

A bit of history

✦ 1987✦ Demers et al. introduced the first gossip protocol, for information

dissemination

✦ '90s✦ Gossip applied to solve communication problems

✦ '00s✦ Gossip revival: beyond dissemination

✦ 2006✦ First workshop on the future of gossip, Leiden (NL)

Page 9: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 9

What is going on?

✦ In the last decade, we have seen dramatic changes in the distributed system area

✦ Shift in the scale of distributed systems✦ larger✦ geographically more dispersed

✦ Traditional failure model do not hold any more✦ “let p1 ... pn be a set of processes...”✦ f < 3n+1, f<n/2 anyone?

✦ dynamic membership: “churn”

Page 10: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 10

What is going on?

✦ We need to re-think our solutions✦ Focus on behavior under continuous change✦ Focus on large-scale

✦ Focus on convergence, maintenance

✦ The laid-back approach of gossip is the right answer✦ gossip protocols are indifferent to changes in the group of communicating nodes,

single nodes are not important

✦ nodes act based on local knowledge, they are only aware of a small (constant/logarithmic size) portion of the global state

✦ convergence is quick (often logarithmic in size)

Page 11: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 11

The plan

✦ Introduce gossip ✓

✦ Let’s start from the beginning✦ Information dissemination

✦ Beyond dissemination✦ Peer sampling

✦ Aggregation✦ Average computation✦ Size estimation

✦ Topology management

✦ Slicing✦ ....

Page 12: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 12

Gossip Lego

✦ Gossip solves a diverse collection of problems

✦ Solutions can be combined to solve more complex problems

✦ Toward Gossip Lego?

Peer sampling

Aggregation Slicing ....

... Load balancing Topology boostrap ...

Swarm intelligence Dist. optimization Heuristics

Page 13: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

Information Dissemination

✦ Bibliography✦ Alan Demers et al. Epidemic algorithms for replicated database maintenance.

In Proc. of the 6th ACM Symposium on Principles of Distributed Computing (PODC’87), 1–12, ACM Press.

13

Page 14: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 14

Setting the stage

✦ XEROX Clearinghouse Servers✦ Database replicated at thousands of nodes ✦ Heterogeneous, unreliable network

✦ Independent updates to single elements of the DB are injected at multiple nodes✦ Updates must propagate to all other nodes or be supplanted by a later updates of that

same element✦ Replicas become consistent after no more new updates

✦ Assuming a reasonable update rate, most information at any given replica is “current”

Page 15: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 15

Model of epidemics

✦ Epidemics study the spread of a disease or infection in terms of populations of infected/uninfected individuals and their rates of change

✦ Following the epidemiology literature, we will name a node p as:✦ Susceptible if p has not yet received an update✦ Infective if p holds an update it is willing to share

✦ Removed if p has the update but is no longer willing to share it

Removed

Infective Susceptible

Page 16: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 16

Model of epidemics

✦ How does it work?✦ Initially, a single individual is infective✦ Individuals get in touch with each other, spreading the update

✦ Rumor spreading, or gossiping, is based on the same principles

✦ Can we apply the same ideas to distributed systems?✦ Our goal is to spread the “infection” (update) as fast as possible!

Page 17: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 17

System model

✦ A database that is replicated at a set of n nodes S = { s1,…, sn }

✦ The copy of the database at node s can be represented by a time-varying partial function:✦ s.value: K → V ×T

✦ K set of keys✦ V set of values✦ T set of timestamps

✦ In the following slides✦ We will omit the key and we will consider only a single key,value pair

Page 18: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 18

System model

✦ For simplicity we will assume a database that stores value and timestamp of a single entry at each node s✦ s.value = (v, t)

✦ To indicate a deletion at time t✦ s.value = (deleted, t)

✦ The update operation is formalized as✦ s.value ← (v, now())✦ It is assumed by this work that now() is a function returning a globally unique

timestamp (no details)

✦ So, a pair with a larger timestamp is considered “newer”

Page 19: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 19

The goal

Eventual Consistency: If no updates take place for a long time, all replicas will gradually become consistent (i.e., the same)

∀r,s ∈ S : r.value=s.value

When a database is replicated at many sites, maintaining consistency in the presence of updates is a significant problem.

Page 20: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 20

Several algorithms for distributing updates

✦ Best effort

✦ Anti-entropy (simple epidemics)✦ Push✦ Pull

✦ Push-pull

✦ Rumor mongering (complex epidemics)✦ Push

✦ Pull✦ Push-pull

✦ Eager epidemic dissemination

Page 21: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 21

Best effort (Direct mail)

✦ How it works?✦ Notify all other nodes of an update soon after it occurs.✦ When receiving an update, check if it is “news”

✦ Node s executes: upon s.value ← (v, now()) do foreach r ∈ S do

send <UPDATE, s.value> to r

upon receive <UPDATE, (v, t)> do if s.value.time < t then

s.value ← (v, t)

✦ Not an epidemic algorithm: just the simplest✦ What happens if the sender fail “in between”?✦ What happens if messages are lost?

✦ What is the load of the sender?

Page 22: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 22

A generic gossip protocol - executed by process p

do once every δ time units q = getPeer(state) sp = prepareMsg(state, q) send (REQ, sp, p) to q

do forever receive (t, sq, q) from * if ( t = REQ ) then sp = prepareMsg(state, q) send (REP, sp, p) to q state = update(state, sq)

A "cycle" of length δ

Init: initialize my local state

Active thread Passive thread

Page 23: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 23

Anti-entropy - Simple epidemics

✦ With respect to a single update (identified by its timestamp), all nodes are either✦ susceptible (they don’t know the update), or✦ infective (they know the update)

✦ Every node regularly chooses another node at random and exchanges database contents, resolving differences✦ Method getPeer()

✦ Select a random member from S-{p}✦ Method prepareMsg()

✦ Simple version: return s.value✦ In most cases: prepare a digest of new updates

✦ Method update()✦ Simple version: see next page✦ In most cases: ask for other data

Page 24: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 24

Implementation of update()

✦ Push

if p.value.time > r.value.time then

r.value ← p.value

✦ Pull

if p.value.time < r.value.time then

p.value ← r.value

✦ Push-pull

if p.value.time > r.value.time then

r.value ← p.value

else

p.value ← r.value

Rumor

Rumor

Susceptible node

Infective node

Rumor

RumorPush

Rumor

Pull

Page 25: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

Anti-entropy

25

Page 26: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

Anti-entropy

25

Page 27: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 26

Anty-entropy: Convergence

Page 28: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 26

Anty-entropy: Convergence

✦ To analyze convergence, we must consider what happens when only a few nodes remain susceptible✦ Let p(i) be the probability of a node being (remaining) susceptible after the i-th

anti-entropy cycle. ✦ Pull:

Page 29: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 26

Anty-entropy: Convergence

✦ To analyze convergence, we must consider what happens when only a few nodes remain susceptible✦ Let p(i) be the probability of a node being (remaining) susceptible after the i-th

anti-entropy cycle. ✦ Pull:

✦ p(i+1) = p(i)2

✦ Push:

Page 30: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 26

Anty-entropy: Convergence

✦ To analyze convergence, we must consider what happens when only a few nodes remain susceptible✦ Let p(i) be the probability of a node being (remaining) susceptible after the i-th

anti-entropy cycle. ✦ Pull:

✦ p(i+1) = p(i)2

✦ Push: ✦ p(i+1) = p(i)(1 - 1/n)n(1-p(i))

For small p(i), p(i+1) ~ p(i)/e✦ Push-pull:

✦ both mechanisms are used, convergence is even more rapid✦ All converge to 0, but pull is more rapid than push, so in practice pull

(or push-pull) is used

Page 31: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 27

Push vs pull

Page 32: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 28

Anti-entropy: Comments

✦ Benefits:✦ Simple epidemics eventually “infect” all the population✦ For a push implementation, the expected time to infect

everyone is log2(n) + ln(n)

✦ Drawbacks:✦ Propagates updates much slower than best effort✦ Requires examining contents of database even when most data agrees, so it cannot

practically be used too often

✦ Normally used as support for best effort, i.e. left running in the background

Page 33: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 29

Anti-entropy: Optimizations

✦ To avoid expensive databases checks:✦ Maintain checksum, compare databases if checksums unequal✦ Maintain recent update lists for time T, exchange lists first

✦ Maintain inverted index of database by timestamp; exchange information in reverse timestamp order, incrementally re-compute checksums

✦ Note: ✦ These optimizations apply to the update problem for large DB

✦ We will see how the same principle (anti-entropy) may be used for several other kind of applications

Page 34: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 30

Rumor mongering - complex epidemics

✦ Susceptive-infective-removed (SIR)✦ Nodes initially susceptive✦ When a node receives a new update it becomes a “hot rumor” and the node infective

✦ A node that has a rumor periodically chooses randomly another node to spread the rumor

✦ Eventually, a node will “lose interest” in spreading the rumor and becomes removed✦ Spread too many times✦ Everybody knows it

✦ Optimizations✦ A sender can hold (and transmit) a list of infective updates rather than just one.

Page 35: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

Rumor mongering

31

Page 36: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

Rumor mongering

31

Page 37: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

Rumor mongering

31

Page 38: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

Rumor mongering

31

Page 39: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 32

Rumor mongering: loss of interest

✦ Counter vs. coin (random)✦ Coin (random): lose interest with probability 1/k✦ Counter: lose interest after k contacts

✦ Feedback vs blind✦ Feedback: lose interest only if the recipient knows the rumor.✦ Blind: lose interest regardless of the recipient.

Page 40: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 33

Rumor mongering

✦ How fast does the system converge to a state where all nodes are not infective? (inactive state)✦ Eventually, everybody will lose interest

✦ Once in this state, what is the fraction of nodes that know the rumor?✦ The rumor may stop before reaching all nodes

Page 41: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 34

Rumor mongering: analysis

✦ Analysis from “real” epidemics theory

✦ Feedback, coin✦ Let s, i and r denote the fraction of susceptible, infective, and removed nodes

respectively. Then:

✦ Solving the equations:

✦ Thus, increasing k we can make sure that most nodes get the rumor, exponentially better

s + i + r = 1ds/dt = −si

di/dt = +si− (1/k)(1− s)i

s = e−(k+1)(1−s)

Page 42: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 35

Quality measures

✦ Residue:✦ The nodes that remain susceptible when the epidemic ends: value of s when i = 0✦ Residue must be as small as possible

✦ Traffic:✦ The average number of database updates sent between nodes✦ m = total update traffic / # of nodes

✦ Delay - We can define two delays:✦ tavg : average time it takes for the introduction of an update to reach a node.✦ tlast : time it takes for the last node to get the update.

Page 43: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 36

Simulation results

17.412.54.530.0113

17.512.75.640.00364

17.712.86.680.00125

16.912.13.300.0372

16.811.01.740.1761

tlasttavg

ConvergenceTrafficm

Residues

Counterk

32152.820.0603

3214.13.910.0214

3213.84.950.0085

33171.590.2052

38190.040.9601

tlasttavg

ConvergenceTrafficm

Residues

Counterk

Using feedback and counter

Using blind and random

Page 44: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 37

Push and pull

✦ Push (what we have assumed so far)✦ If database becomes quiescent, this scheme stops trying to introduce updates.✦ If there are many independent updates, more likely to introduce unnecessary

messages.

✦ Pull✦ If many independent updates, pull is more likely to find a source with a non-empty

rumor list✦ But if database quiescent, it spends time doing unnecessary update requests.

Page 45: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 38

Push and pull

✦ Empirically, in the database system of the authors (frequent updates)✦ Pull has a better residue/traffic relationship than push

✦ Performance of pull epidemic on 1000 nodes using feedback & counters

14.0010.086.090.000004315.3910.074.490.00058217.639.972.700.0311

tlasttavg

ConvergenceTrafficm

Residues

Counterk

Page 46: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 39

Mixing with anti-entropy

✦ Rumor mongering ✦ spreads updates fast with low traffic✦ however, there is still a nonzero probability of nodes remaining susceptible after the

epidemic

✦ Anti-entropy ✦ can be run (infrequently) in the background to ensure all nodes eventually get the

update with probability 1.✦ Since a single rumor that is already known by most nodes dies out quickly

Page 47: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 40

Deletion and death certificates

✦ Deletion✦ We cannot delete an entry just by removing it from a node - the absence of the entry is

not propagated.✦ If the entry has been updated recently, there may still be an update traversing the

network!

✦ Death certificate✦ Solution: replace the deleted item with a death certificate (DC) that has a timestamp

and spreads like an ordinary update

Page 48: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 41

Deletion and death certificates

✦ Problem: ✦ we must, at some point, delete DCs or they may consume significant space

✦ Strategy 1: ✦ retain each DC until all nodes have received it

✦ requires a protocol to determine which nodes have it and to handle node failures

✦ Strategy 2: ✦ hold DCs for some time (e.g. 30 days) and discard them

✦ pragmatic approach, still have the “resurrection” problem; increasing the time requires more space

Page 49: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 42

Spatial Distribution

✦ In the previous exposition✦ The network has been considered

uniform (i.e. all nodes equally reachable)

✦ In reality ✦ More expensive to send updates to

distant nodes

✦ Especially if a critical link needs to be traversed

✦ Traffic can clog these links

Page 50: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

Peer sampling

✦ Bibliography✦ S. Voulgaris, D. Gavidia, and M. Van Steen. Cyclon: Inexpensive membership

management for unstructured p2p overlays. Journal of Network and Systems Management, 13(2):197–217, 2005

✦ M. Jelasity and M. van Steen. Large-scale newscast computing on the Internet. Technical Report IR-503 (October), Vrije Universiteit Amsterdam, Department of Computer Science, Amsterdam, The Netherlands.

✦ M. Jelasity, S. Voulgaris, R. Guerraoui, A.-M. Kermarrec, and M. van Steen. Gossip-based peer sampling. ACM Transactions on Computer Systems, 25(3):8, August 2007

✦ G. P. Jesi, A. Montresor, and M. van Steen. Secure peer sampling. Computer Networks, 2010. To appear.

43

Page 51: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 44

Peer sampling

✦ The first problem to be solved: ✦ Where getPeer() get nodes from?✦ We assumed complete knwoledge of the distributed system

✦ But complete knowledge is costly✦ System is dynamic✦ Network can be extremely large

✦ Solution: peer sampling✦ Provides random samples from the participant set✦ Keeps the participants together in a connected network

Page 52: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

Can you spot the difference?

✦ Traditional gossip✦ Each node has full view of the

network✦ Each node periodically “gossips”

with a random node, out of the whole set

✦ Peer sampling✦ Nodes have a partial view of the

network (a set of “neighbors”)✦ Each node periodically “gossips”

with a random node, out of its partial view

45

Page 53: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

Overlay

✦ An overlay network is a logical network overimposed on a physical network✦ Nodes✦ Logical links between nodes

✦ Examples✦ Structured overlay network

✦ DHTs, trees✦ Unstructured overlay network

✦ Gnutella✦ Bittorrent✦ etc.

Page 54: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

System model

✦ A dynamic collection of distributed nodes that want to participate in a common epidemic protocol✦ Node may join / leave✦ Node may crash at any time

✦ Communication:✦ To communicate with node q, node p must know its address✦ Messages can be lost – high levels of message omissions can be tolerated

Churn

Page 55: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

Our Overlays

✦ State of each node: ✦ A partial view containing c

descriptors✦ (c = view size)

✦ Descriptors of node p contains✦ The address needed to communicate

with p✦ Additional information that may be

needed by different implementations of the peer sampling service

✦ Additional information that may be needed by upper layers

48

A

F

C

D E

B

C, 9

E, 10

A, 7

Vie

Page 56: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 49

A generic gossip protocol - executed by process p

do once every δ time units q = getPeer(state) sp = prepareMsg(state, q) send (REQ, sp) to q

do forever receive (t, sq ) from * if ( t = REQ ) then sp = prepareMsg(state, q) send (REP, sp) to q state = update(state, sq)

A "cycle" of length δ

Init: initialize my local state

Active thread Passive thread

Page 57: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

A generic algorithm

✦ getPeer()✦ select one of the neighbor contained in the view

✦ prepareMsg(view, q)✦ returns a subset of the descriptors contained in the local view

✦ may add other descriptors (e.g. its own)

✦ update(view, msgq)✦ returns a subset of the descriptors contained in the union of the local view and the

received view

50

Page 58: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

Newscast

✦ Descriptor: address + timestamp

✦ getPeer()✦ select one node at random

✦ prepareMsg(view, q)✦ returns the entire view + a local descriptor

with a fresh timestamp

✦ update(view, msgq)✦ returns the C freshest identifiers (w.r.t. timestamp) from the union of local view

and message

51

Page 59: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

Newscast

Page 60: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

ID &Address

Timestamp

91216

ID &Address

Timestamp

71014

Newscast

Page 61: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

ID &Address

Timestamp

91216

ID &Address

Timestamp

71014

1. Pick random peer from my view

Newscast

Page 62: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

ID &Address

Timestamp

91216

ID &Address

Timestamp

71014

1. Pick random peer from my view

Newscast

Page 63: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

ID &Address

Timestamp

91216

ID &Address

Timestamp

71014

1. Pick random peer from my view2. Send each other view + own fresh link

Newscast

Page 64: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

ID &Address

Timestamp

91216

ID &Address

Timestamp

71014

91216

20

1. Pick random peer from my view2. Send each other view + own fresh link

Newscast

Page 65: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

ID &Address

Timestamp

91216

ID &Address

Timestamp

71014

91216

20

1. Pick random peer from my view2. Send each other view + own fresh link

20

71014

Newscast

Page 66: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

ID &Address

Timestamp

91216

ID &Address

Timestamp

71014

91216

20

1. Pick random peer from my view2. Send each other view + own fresh link

3. Keep c freshest links (remove own info, duplicates)

20

71014

Newscast

Page 67: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

ID &Address

Timestamp

91216

ID &Address

Timestamp

71014

91216

20

1. Pick random peer from my view2. Send each other view + own fresh link

3. Keep c freshest links (remove own info, duplicates)

20

71014

Newscast

Page 68: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

ID &Address

Timestamp

141620

ID &Address

Timestamp

141620

1. Pick random peer from my view2. Send each other view + own fresh link

3. Keep c freshest link (remove own info, duplicates)

Newscast

Page 69: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

Newscast

✦ Experiments✦ 100,000 nodes✦ C = 20 neighbors per node

55

Page 70: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

Evaluation framework

✦ Average path length✦ The average of shortest path lengths over all pairs of nodes in the graph

✦ In epidemic dissemination protocols✦ A measure of the time needed to diffuse information from a node to another

56

Page 71: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

Evaluation framework

✦ Clustering coefficient✦ The clustering coefficient of a node p is defined as the # of edges between the

neighbors of p divided by the # of all possible edges between those neighbors✦ Intuitively, indicates the extent to which the neighbors of p know each other.

✦ The clustering cofficient of the graph is the average of the clustering coefficients of all nodes

✦ Examples✦ for a complete graph it is 1✦ for a tree it is 0

✦ In epidemic dissemination protocols✦ High clustering coefficient means several redundant messages are sent when an

epidemic protocol is used

57

Page 72: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

Average path length

✦ Indication of the time and cost to flood the network

58

Page 73: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

Clustering coefficient

✦ High clustering is bad for:✦ Flooding: It results in many redundant messages✦ Self-healing: Strongly connected cluster → weakly connected to the rest of the network

59

}Newscast forms a SMALL WORLD

- High clustering- Low diameter

Page 74: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

In-Degree Distribution

✦ Affects:✦ Robustness

(shows weakly connected nodes)

✦ Load balancing

✦ The way epidemics spread

Page 75: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

Robustness

Sustains up to 68% node failures

Random sustains up to 80%

Page 76: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

Self-healing behaviour

Page 77: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

Cyclon

✦ Descriptor: address + timestamp

✦ getPeer()✦ select the oldest descriptor in the view✦ remove it from the view

✦ prepareMsg(view, q)✦ In active thread:

✦ returns a subset of t-1 random nodes, plus a fresh local identifier✦ In passive thread:

✦ returns a subset of t random nodes

✦ update(view, msgq)✦ discard entries in msgq: p, nodes already know✦ add msgq , removing entries sent to q

Page 78: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

ID &Address

Timestamp

9

412

ID &Address

Timestamp

14

710

Cyclon

Page 79: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

ID &Address

Timestamp

9

412

ID &Address

Timestamp

14

710

1. Pick oldest peer from my view

Cyclon

Page 80: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

ID &Address

Timestamp

9

412

ID &Address

Timestamp

14

710

1. Pick oldest peer from my view

Cyclon

Page 81: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

ID &Address

Timestamp

9

412

ID &Address

Timestamp

14

710

1. Pick oldest peer from my view2. Exchange some neighbors (the pointers)

Cyclon

Page 82: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

ID &Address

Timestamp

9

412

ID &Address

Timestamp

14

710

1. Pick oldest peer from my view2. Exchange some neighbors (the pointers)

Cyclon

Page 83: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

ID &Address

Timestamp

9

412

ID &Address

Timestamp

14

710

1. Pick oldest peer from my view2. Exchange some neighbors (the pointers)

Cyclon

Page 84: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

ID &Address

Timestamp

9

12

ID &Address

Timestamp

14

710

1. Pick oldest peer from my view2. Exchange some neighbors (the pointers)

Cyclon

20

Page 85: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

ID &Address

Timestamp

9

12

ID &Address

Timestamp

147 10

1. Pick oldest peer from my view2. Exchange some neighbors (the pointers)

Cyclon

20

Page 86: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

ID &Address

Timestamp

9

12

ID &Address

Timestamp

14710

1. Pick oldest peer from my view2. Exchange some neighbors (the pointers)

Cyclon

20

Page 87: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

ID &Address

Timestamp

9

12

ID &Address

Timestamp

14710

1. Pick oldest peer from my view2. Exchange some neighbors (the pointers)

Cyclon

20

Guaranteedconnectivity

Page 88: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

Obvious advantages of Cyclon

✦ Connectivity is guaranteed

✦ Uses less bandwidth✦ Only small part of the view is sent

65

Page 89: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

Average path length

✦ Indication of the time and cost to flood the network

66

Page 90: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

Clustering coefficient

✦ High clustering is bad for:✦ Flooding: It results in many redundant messages✦ Self-healing: Strongly connected cluster → weakly connected to the rest of the network

67

Page 91: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

Clustering coefficient

✦ High clustering is bad for:✦ Flooding: It results in many redundant messages✦ Self-healing: Strongly connected cluster → weakly connected to the rest of the network

68

}Cyclon approx. aRANDOM GRAPH

- Low clustering- Low diameter

Page 92: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

In-Degree Distribution

✦ Affects:✦ Robustness

(shows weakly connected nodes)

✦ Load balancing

✦ The way epidemics spread

Page 93: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

Robustness

Sustains up to 80% node failures

Page 94: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

Self-healing behaviour

Page 95: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

Self-healing behaviour

Killed 50,000 nodes at cycle 19

Page 96: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

Non-symmetric overlays

✦ Non-uniform period → Non symmetric topologies✦ A node’s in-degree is proportional to its gossiping frequency✦ Can be used to create topologies with “super-nodes”

73

Page 97: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

Secure peer sampling

✦ This approach is vulnerable to certain kinds of malicious attacks

✦ Hub attack✦ Hub attack involves some set of colluding nodes always gossiping their own ID’s

only✦ This causes a rapid spread of only those nodes to all nodes - we say their views

become “polluted”

✦ At this point all non-malicious nodes are cut-off from each other✦ The malicious nodes may then leave the network leaving it totally disconnected with

no way to recover

✦ Hence the hub attack hijacks the speed of the Gossip approach to defeat the network

74

Page 98: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

Secure peer sampling

Page 99: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

Peer sampling - solution

✦ Algorithm✦ Maintain multiple independent views in each node✦ During a gossip exchange measure similarity of exchanged views

✦ With probability equal to proportion of identical nodes in two views reject the gossip and blacklist the node

✦ Otherwise, whitelist the node and accept the exchange✦ Apply an aging policy to to both white and black lists

✦ When supplying a random peer to API select the current “best” view

76

Page 100: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

Secure peer sampling

1000 nodes

20 malicious nodes

Page 101: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 78

How to compose peer sampling

getPeer()

getPeer()

AggregationprepareMsg()

update()

Peer samplingprepareMsg()

update() getPeer()

getPeer()

Informationdissemination

prepareMsg()update()

Peer samplingprepareMsg()

update()

Page 102: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

Aggregation

✦ Bibliography✦ Márk Jelasity, Alberto Montresor, and Ozalp Babaoglu. Gossip-based aggregation in

large dynamic networks. ACM Trans. Comput. Syst., 23(1):219-252, August 2005.

✦ Additional bibliography✦ Alberto Montresor, Márk Jelasity, and Ozalp Babaoglu. Decentralized ranking in

large-scale overlay networks. In Proc. of the 1st IEEE Selfman SASO Workshop, pages 208-213, Isola di San Servolo, Venice, Italy, November 2008.

79

Page 103: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 80

Aggregation

✦ Definition✦ The collective name of a set of functions that provide statistical information about a

system

✦ Useful in large-scale distributed systems:✦ The average load of nodes in a computing grid

✦ The sum of free space in a distributed storage✦ The total number of nodes in a P2P system

✦ Wanted: solutions that are✦ completely decentralized, robust

Page 104: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 81

A generic gossip protocol - executed by process p

do once every δ time units q = getPeer(state) sp = prepareMsg(state, q) send (REQ, sp) to q

do forever receive (t, sq ) from * if ( t = REQ ) then sp = prepareMsg(state, q) send (REP, sp) to q state = update(state, sq)

A "cycle" of length δ

Init: initialize my local state

Active thread Passive thread

Page 105: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 82

Average Aggregation

✦ Using the gossip schema presented above to compute the average✦ Local state maintained by nodes:

✦ a real number representing the value to be averaged✦ Method getPeer()

✦ invokes getPeer() on the underlying peer sampling layer

✦ Method prepareMessage()✦ return statep

✦ Function update(statep, stateq)✦ return (statep+stateq)/2

Page 106: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 83

The idea

16

10

4

362

8

Page 107: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 84

Basic operation

16

6

4

366

8(10+2)/2=6

Page 108: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 85

Basic operation

16

6

4

366

8

Page 109: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 86

Basic operation

10

6

10

366

8(16+4)/2=10

Page 110: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 87

Some Comments

✦ If the graph is connected, each node converges to the average of the original values

✦ After each exchange:✦ Average does not change✦ Variance is reduced

✦ Different from load balancing due to lack of constraints

Page 111: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 88

A run of the protocol

Page 112: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 89

Questions

✦ Which topology is optimal?

✦ How fast is convergence on different topologies?

✦ What are the effects of node/link failures, message omissions?

✦ Fully connected topol.:exponential convergence

✦ Random topology: practically exponential.

✦ Link failures: not critical

✦ Crashes/msg omissions can destroy convergence

✦ but we have a solution for that

Page 113: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

Theoretical framework

✦ From the “distributed” version to a centralized one

do N times (p, q) = getPair() // perform elementary aggregation step a[p] = a[q] = (a[p] + a[q])/2

✦ Notes:✦ Vector a[1 ... N]

✦ N number of nodes✦ The code corresponds to the execution of single cycle

90

Page 114: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 91

Some definitions

✦ We measure the speed of convergence of empyrical variance at cycle i

✦ Additional definitions✦ Elementary variance reduction step: σi+12/ σi2

✦ Variable φk: the number of times that node k has been selected from getPair()

µi =1n

n�

k=1

ai[k]

σ2i =

1n

n�

k=1

(µi − ai[k])2

Page 115: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 92

The base theorem

✦ If✦ Each pair of values selected by each call to getPair() are uncorrelated;✦ the random variables φk are identically distributed;

✦ let φ denote a random variable with this common distribution

✦ after (p, q) is returned by getPair() the number of times p and q will be selected by the remaining calls to getPair() has identical distribution

✦ Then:

E(σi+12)= E(2-φ) σi2

Page 116: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 93

Results

✦ Optimal case: E(2-φ) = E(2-2) = 1/4✦ getPair() implements perfect matching✦ no corresponding local protocol

✦ Random case: E(2-φ) = 1/e ✦ getPair() implements random global sampling✦ A local corresponding protocol exists

✦ Aggregation protocol: E(2-φ) = 1/(2√e) ✦ Scalability: results independent of N✦ Efficiency: convergence is very fast

Page 117: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 94

Scalability

Page 118: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 95

Convergence factor

Page 119: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 96

Other functions

✦ Average: update(a,b) := (a+b)/2

✦ Geometric: update(a,b) := (a⋅b)1/2

✦ Min/max: update(a,b) := min/max(a,b)

✦ Sum: Average ⋅ Count

✦ Product: GeometricCount

✦ Variance: compute

How?

Means

Obtainedfrommeans

a2 − a2

Page 120: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 97

Counting

✦ The counting protocol✦ Init: one node starts with 1, the others with 0✦ Expected average: 1/N

✦ Problem: how to select that "one node"?✦ Concurrent instances of the counting protocol✦ Each instance is lead by a different node

✦ Messages are tagged with a unique identifier ✦ Nodes participate in all instances ✦ Each node acts as leader with probability p=c/NE

Page 121: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 98

Adaptivity

✦ The generic protocol is not adaptive✦ Dynamism of the network✦ Variability of values

✦ Periodical restarting mechanism✦ At each node:

✦ The protocol is terminated ✦ The current estimate is returned as the aggregation output✦ The current values are used to re-initialize the estimates✦ Aggregation starts again with fresh initial values

Page 122: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 99

Adaptivity

✦ Termination ✦ Run protocol for a predefined number of cycles λ✦ λ depends on

✦ required accuracy of the output✦ the convergence factor that can be achieved

✦ Restarting✦ Divide run in consecutive epochs of length Δ ✦ Start a new instance of the protocol in each epoch✦ Concurrent epochs depending on the ratio λδ / Δ

Page 123: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 100

Dynamic Membership

✦ When a node joins the network✦ Discovers a node n already in the network ✦ Membership: initialization of the local neighbors

✦ Receives from n:✦ Next epoch identifier✦ The time until the start of the next epoch

✦ To guarantee convergence:Joining node is not allowed to participate in the current epoch

Page 124: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 101

Dynamic Membership

✦ Dealing with crashes, message omissions ✦ In the active thread:

✦ A timeout is set to detect the failure of the contacted node✦ If the timeout expires before the message is received → the exchange step is

skipped

✦ What are the consequences?✦ In general: convergence will slow down

✦ In some cases: estimate may converge to the wrong value

Page 125: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 102

Synchronization

✦ The protocol described so far:✦ Assumes synchronized epochs and cycles✦ Requires synchronized clocks / communication

✦ This is not realistic:✦ Clocks may drift✦ Communication incurs unpredictable delays

✦ Complete synchronization is not needed✦ It is sufficient that the time between the first/ last node starting to participate in an

epoch is bounded

Page 126: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 103

Cost analysis

✦ If the overlay is sufficiently random:✦ exchanges = 1 + φ, where φ has Poisson distribution with average 1

✦ Cycle length δ defines the time complexity of convergence:✦ Small δ: fast convergence

✦ Large δ: small cost per unit time, may be needed to complete exchanges

✦ λ defines the accuracy of convergence:✦ E(σλ2 )/E(σ02) = ρλ, ε the desired accuracy → λ ≥ logρ ε

Page 127: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 104

Topologies

✦ Theoretical results are based on the assumption that the underlying overlay is sufficiently random

✦ What about other topologies?✦ Our aggregation scheme can be applied to generic connected topologies✦ Small-world, scale-free, newscast, random, complete

✦ Convergence factor depends on randomness

Page 128: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 105

Topologies

Page 129: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 106

Topologies

Page 130: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 107

Simulation scenario

✦ The underlying topology is based on Newscast✦ Realistic, Robust

✦ The count protocol is used✦ More sensitive to failures

✦ Some parameters:✦ Network size is 100.000✦ Partial view size in Newscast is 30

✦ Epoch length is 30 cycles✦ Number of experiments is 50

Page 131: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 108

Effects of node failures

✦ Effects depend on the value lost in a crash:✦ If lower than actual average: estimated average will increase, estimated size will

decrease✦ If higher than actual average: estimated average will decrease, estimated size will

increase

✦ The latter case is worst:✦ In the initial cycles, some nodes hold relatively large values

✦ Simulations:✦ Sudden death / dynamic churn of nodes

Page 132: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 109

Sudden death

Page 133: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 110

Nodes joining/crashing

Page 134: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 111

Communication failures

✦ Link failures✦ The convergence is just slowed down – some of the exchanges do not happen

✦ Partitioning:✦ If multiple concurrent protocols are started, the size of each partition will be evaluated

separately

✦ Message omissions:✦ Message carry values: losing them may influence the final estimate

Page 135: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 112

Link failures

Page 136: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 113

Message omissions

Page 137: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 114

Multiple instances of aggregation

✦ To improve accuracy in the case of failures:✦ Multiple concurrent instances of the protocol may be run✦ Median value taken as result

✦ Simulations✦ Variable number of instances✦ With node failures

✦ 1000 nodes substituted per cycle

✦ With message omissions✦ 20% of messages lost

Page 138: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 115

Node failures

Page 139: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 116

Message omissions

Page 140: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 117

All together now!

Page 141: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 118

Planet-Lab

Consortium >500 universities, research institutes, companies

>1000 nodes

Page 142: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 119

600 hosts, 10 nodes per hosts

Page 143: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

Topology management

✦ Bibliography✦ M. Jelasity, A. Montresor, and O. Babaoglu. T-Man: Gossip-based fast overlay

topology construction. Computer Networks, 53:2321-2339, 2009.✦ A. Montresor, M. Jelasity, and O. Babaoglu. Chord on demand. In Proc. of the 5th

International Conference on Peer-to-Peer Computing (P2P'05), pages 87-94, Konstanz, Germany, August 2005. IEEE.

✦ Additional bibliography✦ G.P.Jesi, A. Montresor, and O. Babaoglu. Proximity-aware superpeer overlay

topologies. In Proc. of SelfMan'06, volume 3996 of Lecture Notes in Computer Science, pages 43-57, Dublin, Ireland, June 2006. Springer-Verlag.

✦ A. Montresor. A robust protocol for building superpeer overlay topologies. In Proceedings of the 4th International Conference on Peer-to-Peer Computing, pages 202-209, Zurich, Switzerland, August 2004. IEEE

120

Page 144: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 121

Topology bootstrap

✦ Informal definition:✦ building a topology from the ground up as

quickly and efficiently as possible

✦ Do not confuse with node bootstrap✦ Placing a single node in the right place in the topology

✦ Much more complicated: start from scratch

Page 145: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 122

The T-Man Algorithm

✦ T-man is a generic protocol for topology formation✦ Topologies are expressed through ranking functions:

“what are my preferred neighbors?”

✦ Examples✦ Rings, tori, trees, DHTs, etc.

✦ Distributed sorting✦ Semantic proximity for file-sharing

✦ Latency for proximity selection.....Author's personal copy

In Table 1 we summarize the parameters of the proto-col. Note that K (target view size) is not a parameter ofthe protocol but is part of the target graph characteriza-tion. As such, it controls the size of the target graph, andconsequently, affects the running time of the protocol.For example, if we increase K while keeping the rankingmethod fixed, then the protocol will take longer to con-verge since it has to find a larger number of links. In fact,K could be omitted if the target graph was defined in someother, more complex manner.

5. Key properties of the protocol

In this section we study the behavior of our protocol asa function of its parameters, in particular, m (messagesize), w (peer sampling parameter) and the ranking methodRANK. Based on our findings, we will extend the basicversion of the peer selection algorithm with a simple‘‘tabu-list” technique as described below. Furthermore,we analyze the storage complexity of the protocol andconclude that on the average, nodes need O!logN" storagespace where N is the network size.

To be able to conduct controlled experiments withT-MAN on different ranking methods, we first select a graphinstead of a ranking method, and subsequently ‘‘reverse-engineer” an appropriate ranking method from this graphby defining the ranking to be the ordering consistent withthe minimal path length from the base node in the selectedgraph. We will call this selected graph the ranking graph, toemphasize its direct relationship with the ranking method.

Note that the target graph is defined by parameter K, sothe target graph is identical to the ranking graph only if theranking graph is K-regular. However, for convenience, inthis section we will not rely on K because we either focuson the dynamics of convergence (as opposed to conver-gence time), which is independent of K, or we study thediscovery of neighbors in the ranking graph directly.

In order to focus on the effects of parameters, in thissection we assume a greatly simplified system modelwhere the protocol is initiated at the same time at allnodes, where there are no failures, and where messagesare delivered instantly. While these assumptions areclearly unrealistic, in Section 6 we show through event-based simulations that the protocol is extremely robustto failures, asynchrony and message delays even in morerealistic settings.

5.1. Analogy with the anti-entropy epidemic protocol

In Section 3 we used an (unspecified) dissemination ap-proach to define the overlay construction problem. Herewe would like to elaborate on this idea further. Indeed,the anti-entropy epidemic protocol, one implementationof such a dissemination approach, can be seen as a specialcase of T-MAN, where the message size m is unlimited (i.e.,m P N such that every possible node descriptor can besent in a single message) and peer selection is uniform ran-dom from the entire network. In this case, independent ofthe ranking method, all node descriptors that are presentin the initial views will be disseminated to all nodes. Fur-thermore, it is known that full convergence is reached inless than logarithmic time in expectation [25].

For this reason, the anti-entropy epidemic protocol isimportant also as a base case protocol when evaluatingthe performance of T-MAN, where the goal is to achievesimilar convergence speed to anti-entropy, but with theconstraint that communication is limited to exchanging aconstant amount of information in each round. Due tothe communication constraint, performance will no longerbe independent of the ranking method.

5.2. Parameter setting for symmetric target graphs

We define a symmetric target graph to be one where allnodes are interchangeable. In other words, all nodes haveidentical roles from a topological point of view. Such graphsare very common in the literature of overlay networks. Thebehavior of T-MAN is more easily understood on symmetricgraphs, because focusing on a typical (average) node gives agood characterization of the entire system.

We will focus on two ranking graphs, both undirected:the ring and a k-out random graph, where k random out-links are assigned to all nodes and subsequently the direc-tionality of the links is dropped. We choose these twographs to study two extreme cases for the network diame-ter. The diameter (longest minimal path) of the ring is O!N"

after 2 cycles after 3 cycles after 4 cycles after 7 cycles

Fig. 3. Illustration of constructing a torus over 50# 50 $ 2500 nodes, starting from a uniform random graph with initial views containing 20 randomentries and the parameter values m $ 20;w $ 10, K $ 4.

Table 1Parameters of the T-MAN protocol.

RANK() Ranking method: determines the preference of nodesas neighbors of a base node

D Cycle length: sets the speed of convergence but also thecommunication cost

w Peer sampling parameter: peers are selected from the w mostpreferred known neighbors

m Message size: maximum number of node descriptors that can besent in a single message

M. Jelasity et al. / Computer Networks 53 (2009) 2321–2339 2325

Page 146: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 123

Ranking function

✦ Node descriptors contain attributes of the nodes✦ A number in a sorting application✦ The id of a node in a DHT

✦ A semantic description of the node

✦ Example: Sorted “Virtual” Ring✦ Let the ranking function be defined based on the distance

d(a,b)=min(|a-b|, 2t-|a-b|)

assuming that attributes are included in [0,2t[

Page 147: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 124

Ranking function

✦ Node descriptors contain attributes of the nodes✦ A number in a sorting application✦ The id of a node in a DHT

✦ A semantic description of the node

✦ The ranking function may be based on a distance over a space✦ Space: set of possible descriptor values

✦ Distance: a metric d(x,y) over the space✦ The ranking function of node x is defined over the distance from node x

✦ getPeer(), prepareMsg() are based on a ranking function defined over node descriptors

Page 148: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 125

A generic gossip protocol - executed by process p

do once every δ time units q = getPeer(state) sp = prepareMsg(state, q) send (REQ, sp) to q

do forever receive (t, sq ) from * if ( t = REQ ) then sp = prepareMsg(state, q) send (REP, sp) to q state = update(state, sq)

A "cycle" of length δ

Init: initialize my local state

Active thread Passive thread

Page 149: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 126

Gossip customization for topology construction

✦ local state✦ partial view, initialized randomly based on Newscast✦ the view grows whenever a message is received

✦ getPeer(): ✦ randomly select a peer q from the r nodes in my view that are closest to p in terms of

distance

✦ prepareMsg(): ✦ send to q the r nodes in local view that are closest to q

✦ q responds with the r nodes in its view that are closest to p

✦ update(): ✦ both p and q merge the received nodes to their view

Page 150: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 127

T-man: Topology Management

20

90

700

993

175

130

499

Page 151: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 128

T-man: Topology Management

175

getPeer

20

90

130

700

499

993

10

15

170

800

187

900

130

Page 152: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 129

T-man: Topology Management

175 130

Exchange of partial views

20

90

130

700

200

993

10

15

170

800

187

900

130

90

200

170

187

Page 153: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 130

T-man: Topology Management

Both sides apply update

thereby redefining topology

175 13020

90

130

700

200

993

10

15

170

800

187

900

130

90

200

170

187

Page 154: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 131

Distance functions

✦ Example: Line or ring✦ Space: [0, 1[✦ Distance over the line: d(a,b) = | a-b |

✦ Distance over thr ring: d(a,b) = min { | a-b | , 1-|a-b| }

✦ Example: Grid or torus (Manhattan Distance)✦ Space: [0, 1[ · [0, 1[

✦ Distance: d(a,b) = | ax – bx | + | ay – by |

Page 155: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 132

Example: Line

Page 156: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 133

Sorted Line / Ring

✦ Directional ranking function over the ring defined as follows:✦ Distance function, line: d(a,b)=|a-b|✦ Distance function, ring: d(a,b)=min(|a-b|, 1-|a-b|)

✦ Given a collection (view) of nodes and a node x, return✦ the r/2 nodes “smaller” than x that are closest to x ✦ the r/2 nodes “larger” than x that are closest to x

Page 157: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 134

Sorted Line

Page 158: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 135

Sorted Ring

p

q

0 2m-1

2m-10

Page 159: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 136

Sorted Ring

p

q

0 2m-1

2m-10

Page 160: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 137

T-Man: The movie!

Cycles NodesNodes: 1000Showing 1 successor, 1 predecessor

Page 161: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

Start / stop

✦ In the previous animation✦ Nodes starts simultaneously✦ Convergence is measured globally

✦ In reality✦ We must start the protocol at all nodes

✦ Broadcasting, using the random topology obtained through the peer sampling services

✦ We must stop the protocol✦ Local condition: when a node does not observe any view

change for a predefined period, it stops✦ Idle: number of cycles without variations

138

Page 162: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

Start / stop

139

Author's personal copy

as shown in Fig. 12. In the worst of our experiments, we ob-served that nomore than 0.1% of the target links weremiss-ing at termination. This may be sufficient for mostapplications, especially considering that the target graphswill never be constructed perfectly in a dynamic scenario,wherenodes are addedand removedcontinously.Neverthe-less, from now on, we discard the parameter combinationsthat do not always converge.

Apart from longer executions, an additional conse-quence of choosing large values of didle is a higher commu-nication cost. However, since not all nodes are activeduring the execution, the overall number of messages sentper node on average is less than one quarter of the numberof cycles until global termination. To understand this bet-ter, Fig. 13 shows how many nodes are active during theconstruction of SORTED RING and TREE, respectively. The curvesshow both an exponential increase in the number of activenodes when starting, and an exponential decrease whenstopping. The period of time in which all nodes are activeis relatively short.

These considerations suggest the use of higher valuesfor didle, at the cost of a larger termination time and a largernumber of exchanged messages. The chosen value of didle(4 s) represents a good tradeoff between the desire ofobtaining a perfect target graph and the consequently lar-ger cost in time and communication.

6.7. Parameter tuning

6.7.1. Cycle lengthIf a faster execution is desired, one can always decrease

the cycle length. However, after some point, decreasing cy-cle length does not pay off because message delay becomeslonger than the cycle length and eventually the networkwillbe congested byT-MANmessages. Fig. 14 shows thebehavior

99.9 99.91

99.92

99.93

99.94

99.95

99.96

99.97

99.98

99.99 100

2 4 6 8 10 12

Targ

et L

inks

Fou

nd (%

)

!idle (s)

size=210

size=213

size=216

Fig. 12. Quality of the target TREE graph at termination time as a functionof didle.

0

20

40

60

80

100

0 5 10 15 20 25 30

activ

e no

des

(%)

Time (s)

size=210

size=213

size=216

(a) SORTED RING

0

20

40

60

80

100

0 5 10 15 20 25 30

activ

e no

des

(%)

Time (s)

size=210

size=213

size=216

(b) TREE

Fig. 13. Proportion of active nodes during execution.

10

15

20

25

30

35

40

45

50

0 0.5 1 1.5 2 2.5 3 3.5 4

Term

inat

ion

Tim

e (c

ycle

s)

Cycle Length (s)(a) SORTED RING

10

15

20

25

30

35

40

45

50

0 0.5 1 1.5 2 2.5 3 3.5 4

Term

inat

ion

Tim

e (c

ycle

s)

Cycle Length (s)(b) TREE

Fig. 14. Termination time as a function of cycle length.

M. Jelasity et al. / Computer Networks 53 (2009) 2321–2339 2333

Page 163: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 140

T-Man: Scalability

Author's personal copy

Communication cost. The number of messages exchanged.Note that all messages everexchanged are of the same size.

The unit of time will be cycles or seconds, dependingon which is more convenient (note that cycle length de-faults to 1 s). We also note that convergence time is notdefined if the protocol terminates before converging. Inthis case, we use the number of identified target linksas a measure.

6.5. Evaluating the starting mechanism

Fig. 10 shows the convergence time for SORTED RING andTREE, using the starting protocols described in Section6.1.2. The cycle length of the anti-entropy versions wasthe same as that of T-MAN, and the flooding protocol used20 random neighbors at all nodes. The case of synchronousstart is also shown for comparison. Note that these figuresdo not represent a direct measure of the performance ofwell-known starting protocols; rather, convergence timeplotted here represents the overall time needed to bothstart the protocol and reach convergence, with T-MAN andthe broadcast protocol running concurrently.

In the case of flooding, ‘‘wake up” messages quicklyreach all nodes and activate the protocol; almost no delay

is observed compared to the synchronous case. Anti-entro-py mechanisms result in a few seconds of delay. In theexperiments that follow, we adopt the anti-entropy,push–pull approach, as it represents a good tradeoff be-tween communication costs and delay. Note however that(unlike the push approach) the push–pull approach as-sumes that at least the starting service was started at allnodes already.

6.6. Evaluating the termination mechanism

We experimented with various settings for didle rangingfrom 2 s to 12 s. Fig. 11 shows both convergence time (bot-tom three curves) and termination time (top three curves)for different values of didle, for SORTED RING and TREE, respec-tively. In both cases, termination time increases linearlywith didle. This is because, assuming the protocol has con-verged, each additional cycle to wait simply adds to thetermination time.

For small values convergence was not always reached,especially for TREE. For SORTED RING, all runs converged exceptthe case when didle ! 2 and N ! 216, when 76% of the runsconverged. For TREE, all runs converged with didle > 5 andno runs converged for "didle ! 2;N ! 213#; "didle ! 2;N !216#, and "didle ! 3;N ! 216#. Even in these cases, the qualityof the target graph at termination time was almost perfect,

5

10

15

20

25

30

210 211 212 213 214 215 216 217 218

Con

verg

ence

Tim

e (s

)

Network Size

Anti-Entropy (Push)Anti-Entropy (Push-Pull)

FloodingSynchronous start

(a) SORTED RING

5

10

15

20

25

30

210 211 212 213 214 215 216 217 218

Con

verg

ence

Tim

e (s

)

Network Size

Anti-Entropy (Push)Anti-Entropy (Push-Pull)

FloodingSynchronous start

(b) TREE

Fig. 10. Convergence time as a function of size, using different startingprotocols.

10

20

30

40

50

2 3 4 5 6 7 8

Tim

e (s

)

! idle (s)

size = 216

size = 213

size = 210

(a) SORTED RING

10

20

30

40

50

2 3 4 5 6 7 8

Tim

e (s

)

! idle (s)

size = 216

size = 213

size = 210

(b) TREE

Fig. 11. Convergence time (bottom curves) and termination time (topcurves) as a function of didle.

2332 M. Jelasity et al. / Computer Networks 53 (2009) 2321–2339

Page 164: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 141

T-Man: Message costs

Author's personal copy

of T-MAN with a cycle length varying between 0.2 s and 4 s.Thefigure shows thenumberof cycles required to terminatethe protocol. Small cycle lengths require a larger number ofcycles, while after a given threshold (around 1 s), the num-ber of cycles required to complete a protocol is almost con-stant. The reason for this behavior is that with short cycles,multiple cyclesmaybe executedbefore amessage exchangeis concluded, thus wasting bandwidth in sending andreceiving old information multiple times.

6.7.2. Message sizeIn Section 5, we have examined the effect of themessage

size parameter (m) in detail. Here we are interested in theeffect of message size on termination time. Fig. 15 showsthat by increasing the size of messages exchanged by SORTEDRING termination time slightly increases after aroundm ! 20. The reason is that a node becomes suspended onlyafter the local view remains unchanged for a fixed numberof cycles, but increasing the message size has the effect ofincreasing the number of cycles in which view changesmight occur, thus delaying termination. The results for TREE

havemore variance,whichmight have to dowith the unbal-anced nature of the topology, as discussed in Section 5.3.

6.8. Failures

The results discussed so far were obtained in static net-works, without considering any form of failure. Here, we

consider two sources of failure: message losses and nodecrashes. Since in this paper we consider only the overlayconstruction problem, and not maintenance, we do notexplicitly consider scenarios involving node churn. Instead,we model churn through nodes leaving, and do not allow-ing joining nodes to participate in an ongoing construction.Furthermore, since we do not have a leave protocol, leavingnodes are identical to crashing nodes from our point ofview.

6.8.1. Message lossWhile a simple solution could be to adopt a reliable,

connection-oriented transport protocol like TCP, it is moreattractive to rely on a lightweight but perhaps unreliabletransport. In this case, we need to demonstrate thatT-MAN can cope well with message loss. Fig. 16 shows thatT-MAN is highly resilient to message loss and so a data-gram-oriented protocol like UDP is a perfectly suitablechoice, as message losses only slow down the protocolslightly. Many message exchanges are either never startedor never completed, thus requiring more cycles to termi-nate the protocol execution. The quality does not suffermuch either. In both SORTED RING and TREE, around 1% ofthe target links may be missing, as shown by Fig. 17. Notethat the mean message loss ratio for geographic networkslike the Internet is around 2% [30], an order of magnitudesmaller than the maximum message loss ratio tested inour experiments.

10

20

30

40

50

60

5 10 15 20 25 30

Term

inat

ion

Tim

e (c

ycle

s)

Message Size(a) SORTED RING

10

20

30

40

50

60

5 10 15 20 25 30

Term

inat

ion

Tim

e (c

ycle

s)

Message Size(b) TREE

Fig. 15. Termination time as a function of message size.

0

10

20

30

40

50

60

0 5 10 15 20

Term

inat

ion

time

(s)

Message loss (%)

size = 210

size = 213

size = 216

(a) SORTED RING

0

10

20

30

40

50

60

0 5 10 15 20

Term

inat

ion

time

(s)

Message loss (%)

size = 210

size = 213

size = 216

(b) TREE

Fig. 16. Termination time as a function of message loss rate.

2334 M. Jelasity et al. / Computer Networks 53 (2009) 2321–2339

Page 165: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 142

T-Man: Robustness to crashes

Author's personal copy

6.8.2. Node crashesFig. 18 shows the behavior of T-MAN with a variable fail-

ure rate, measured as the total number of nodes leavingthe network per second per node. We experimented withvalues ranging from 0 to 10!2, which is two orders ofmagnitude larger than the value of 10!4 suggested as thetypical behavior of some P2P networks [31]. The resultsshow that both SORTED RING and TREE are robust in normalscenarios, with TREE being considerably more reliable inthe range of extreme failure rates. This is due to the unbal-anced nature of the topology as discussed in Section 5.3.

7. Bootstrapping CHORD

After analyzing the behavior of T-MAN on relatively ba-sic examples, in this section we present a more complexapplication: rapidly bootstrapping CHORD-like networks[8]. We call this protocol T-CHORD.

7.1. A brief introduction to CHORD

CHORD is an example of a key-based overlay routingprotocol. In such protocols, subsets of the key space areassigned to nodes, and each node has a routing table thatit uses to route messages addressed by a specific key

towards the node that is responsible for that key.These routing protocols are used as a component in theimplementation of the distributed hash table abstraction,where (key, object) pairs are stored over a decentralizedcollection of nodes and retrieved through the routingprotocol.

We provide a simplified description of CHORD, necessaryto understand T-CHORD. Nodes are assigned random t-bitIDs; keys are taken from the same space. The ID length tmust be large enough to make the probability of two nodesor two keys having the same ID negligible. Nodes are or-dered in an sorted ring as described in Section 6.3.1. Theway this ring is constructed naturally inspires a followsrelation over the entire ID (and key) space: we say that afollows b if "a! b# 2t$j2t < 2t!1; otherwise, a precedes b.We also define a notion of distance, again, inspiredby the sorted ring, as follows: d"a; b$ % min"ja! bj;2t!ja! bj$. The successor of an arbitrary number i (that is,not necessarily existing node ID) is the node with thesmallest ID that follows i, as defined above. We denotethe successor of i by succ1"i$. The concepts of predecessor,jth successor, and jth predecessor are defined similarly.Key k is under the responsibility of node succ1"k$.

Each node maintains a routing table that has two parts:leaves and fingers. Leaves define an r-regular lattice, where

98.6

98.8

99

99.2

99.4

99.6

99.8

100

0 5 10 15 20

Targ

et L

inks

Fou

nd (%

)

Message loss (%)

size = 210

size = 213

size = 216

(a) SORTED RING

98.6

98.8

99

99.2

99.4

99.6

99.8

100

0 5 10 15 20

Targ

et L

inks

Fou

nd (%

)

Message loss (%)

size = 210

size = 213

size = 216

(b) TREE

Fig. 17. Target links found by the termination time as a function ofmessage loss rate.

98

98.5

99

99.5

100

0 0.002 0.004 0.006 0.008 0.01

Targ

et L

inks

Fou

nd (%

)

Node failures per node per second

size=216

size=213

size=210

(a) SORTED RING

98

98.5

99

99.5

100

0 0.002 0.004 0.006 0.008 0.01

Targ

et L

inks

Fou

nd (%

)

Node failures per node per second

size=216

size=213

size=210

(b) TREE

Fig. 18. Target links found by the termination time as a function of failurerate.

M. Jelasity et al. / Computer Networks 53 (2009) 2321–2339 2335

Page 166: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 143

T-Man: Robustness to message losses

Author's personal copy

6.8.2. Node crashesFig. 18 shows the behavior of T-MAN with a variable fail-

ure rate, measured as the total number of nodes leavingthe network per second per node. We experimented withvalues ranging from 0 to 10!2, which is two orders ofmagnitude larger than the value of 10!4 suggested as thetypical behavior of some P2P networks [31]. The resultsshow that both SORTED RING and TREE are robust in normalscenarios, with TREE being considerably more reliable inthe range of extreme failure rates. This is due to the unbal-anced nature of the topology as discussed in Section 5.3.

7. Bootstrapping CHORD

After analyzing the behavior of T-MAN on relatively ba-sic examples, in this section we present a more complexapplication: rapidly bootstrapping CHORD-like networks[8]. We call this protocol T-CHORD.

7.1. A brief introduction to CHORD

CHORD is an example of a key-based overlay routingprotocol. In such protocols, subsets of the key space areassigned to nodes, and each node has a routing table thatit uses to route messages addressed by a specific key

towards the node that is responsible for that key.These routing protocols are used as a component in theimplementation of the distributed hash table abstraction,where (key, object) pairs are stored over a decentralizedcollection of nodes and retrieved through the routingprotocol.

We provide a simplified description of CHORD, necessaryto understand T-CHORD. Nodes are assigned random t-bitIDs; keys are taken from the same space. The ID length tmust be large enough to make the probability of two nodesor two keys having the same ID negligible. Nodes are or-dered in an sorted ring as described in Section 6.3.1. Theway this ring is constructed naturally inspires a followsrelation over the entire ID (and key) space: we say that afollows b if "a! b# 2t$j2t < 2t!1; otherwise, a precedes b.We also define a notion of distance, again, inspiredby the sorted ring, as follows: d"a; b$ % min"ja! bj;2t!ja! bj$. The successor of an arbitrary number i (that is,not necessarily existing node ID) is the node with thesmallest ID that follows i, as defined above. We denotethe successor of i by succ1"i$. The concepts of predecessor,jth successor, and jth predecessor are defined similarly.Key k is under the responsibility of node succ1"k$.

Each node maintains a routing table that has two parts:leaves and fingers. Leaves define an r-regular lattice, where

98.6

98.8

99

99.2

99.4

99.6

99.8

100

0 5 10 15 20

Targ

et L

inks

Fou

nd (%

)

Message loss (%)

size = 210

size = 213

size = 216

(a) SORTED RING

98.6

98.8

99

99.2

99.4

99.6

99.8

100

0 5 10 15 20

Targ

et L

inks

Fou

nd (%

)

Message loss (%)

size = 210

size = 213

size = 216

(b) TREE

Fig. 17. Target links found by the termination time as a function ofmessage loss rate.

98

98.5

99

99.5

100

0 0.002 0.004 0.006 0.008 0.01

Targ

et L

inks

Fou

nd (%

)

Node failures per node per second

size=216

size=213

size=210

(a) SORTED RING

98

98.5

99

99.5

100

0 0.002 0.004 0.006 0.008 0.01

Targ

et L

inks

Fou

nd (%

)

Node failures per node per second

size=216

size=213

size=210

(b) TREE

Fig. 18. Target links found by the termination time as a function of failurerate.

M. Jelasity et al. / Computer Networks 53 (2009) 2321–2339 2335

Page 167: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

T-Chord

✦ How it works?✦ Node descriptor contains node ID in a [0..2t[ space✦ Nodes are sorted over the ring defined by IDs

✦ Final output is the Chord ring✦ As by-product, many other nodes are discovered

✦ Example:✦ t=32, size=214, msg size=20

144

Page 168: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

T-Chord

145

4.5

5

5.5

6

6.5

7

7.5

8

8.5

9

210 211 212 213 214 215 216 217 218

Hop

Cou

nt

Size

ChordT-Chord

T-Chord-Prox

Figure 3. Hop count as a function of networksize

200

300

400

500

600

700

800

210 211 212 213 214 215 216 217 218

Late

ncy

(ms)

Size

ChordT-Chord

T-Chord-Prox

Figure 4. Message delay as a function of net-work size

T-MAN cycles that have been run. Initially, all messages arelost: local views contain only random nodes, so the rout-ing algorithm is unable to deliver messages. The loss raterapidly decreases, however, reaching 0 after only 14 cy-cles. At that point, the leaf ring is completely formed inall our experiments. Note that the curves for T-CHORD andT-CHORD-PROX overlap almost completely.

Regarding hop counts, the results confirm that the qual-ity of the routing tables stabilizes after few cycles, for bothversions of T-CHORD. Latency (not shown for space rea-sons) follows a similar behavior. The increasing tendencyof the hop count curves is explained by the fact that in thebeginning, in spite of the low quality overlay, a few mes-sages reach their destination “by chance” in a few hops,while most of the messages are lost.

6

8

10

12

14

16

18

20

22

24

210 211 212 213 214 215 216 217 218

Cyc

les

Size

1-regular lattice5-regular lattice

Figure 5. Convergence time as a function ofnetwork size

5.3. Scalability

The experiments discussed so far were run in a networkwith a fixed size (216 nodes). To assess the scalability ofT-CHORD, Figure 3 plots the average hop count against net-work size varying in the range [210, 218]. Results for theideal Chord topology are also shown. All algorithms scalelogarithmically with size. Quite interestingly, T-CHORD per-forms slightly better than Chord. This is explained by thefact that the distance of the longest fingers tend to be largerin our case (due to not strictly satisfying the Chord specifi-cation), which speeds up reaching the destination node if itresides in the most distant half of the ring.

Figure 4 plots the average message delay in the samesettings. As expected, T-CHORD-PROX outperforms both T-CHORD and Chord, due to its latency-optimized set of fin-gers. To obtain such performance, T-CHORD-PROX pays aprice in terms of latency probes. In this experimental set-ting, with parameter p set to 5, we have observed a totalnumber of probes per node scaling logarithmically from 45(for N = 210) to 77 (for N = 218). This is expected, as thenumber of finger entries that are not empty is O(log N) [3].These values are comparable with those reported for otherproximity-based protocols like Pastry [1], and can be tunedby varying the p parameter.

Finally, Figure 5 plots the number of cycles needed toobtain the 1-regular lattice (the ring), sufficient to guaran-tee the consistent routing of messages (absence of messagelosses) [3], and the l-regular lattice used to provide addi-tional fault-tolerance. In both cases, the convergence is ob-tained in a logarithmic number of cycles.

5.4. Parameters

To evaluate the impact of the T-MAN message size (m)on the routing performance of our algorithm, we performed

Page 169: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 146

Robustness to failures

Page 170: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 147

Robustness to failures

Page 171: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 148

Conclusions

This mechanism to build Chord is tightly tailored on the particular structure of Chord

A more generic approach: Define a ranking function where nodes have a preference for successors and

predecessors AND fingers

Approx. same results, only slightly more complex to explain

Can be used for Pastry, for example: Define a ranking function where nodes have a preference for successors and

predecessors AND nodes in the prefix-based routing table

Page 172: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

Size estimation

✦ Bibliography✦ A. Montresor and A. Ghodsi. Towards robust peer counting. In Proc. of the 9th Int.

Conference on Peer-to-Peer (P2P'09), pages 143-146, Seattle, WA, September 2009

149

Page 173: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 150

Network size estimation at runtime

✦ Why✦ f(n) routing pointers

✦ to bound the hop count✦ to provide churn resilience

✦ build group of size f(n)✦ Slicing

✦ f(n) messages✦ to reduce overhead in gossip protocols

✦ How✦ Combine and improve existing protocols✦ Compared to existing systems:

✦ More precise, more robust, slightly more overhead

✦ Simple idea → short paper

Page 174: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 151

A brief explanation

70

80

97

112

127 7 14

23

3942

46

15 8 79

16

34

2410

17

15 11.63128/11.63=12

✦ Assign random numbers in [0, d[✦ Locally; here, d=127

✦ Build a ring topology✦ Gossip topology construction (T-Man)

✦ Compute the distance to thesuccessor

✦ Locally

✦ Compute the average distance a✦ Gossip aggregation

✦ Compute size

✦ d / a = n

Page 175: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 152

Scalability

0.0

1.0

2.0

3.0

4.0

5.0

210 211 212 213 214 215 216 217 218

Ove

rhea

d pe

r nod

e (k

B)

Size

T-SizeAverage

30 35 40 45 50 55 60 65 70 75

Conv

erge

nce

Tim

e (s

)

T-SizeAverage

Fig. 5. Scalability

IV. DISCUSSION AND CONCLUSIONSEpidemic protocols for peer counting have been proposed

by Jelasity et al. in 2005 [11]; the idea was to use AVERAGE,initializing all nodes to 0, apart from one node set to 1 (theinitiator). The network size n could be easily derived from thecomputed average 1/n. The problem of this approach was itssensitivity to failures; in the first phases of the computation,the failure of the initiator or its neighbors nodes could easilydouble the estimate. Furthermore, the initial estimate at thenodes were exceedingly inaccurate. T-SIZE is more robust tofailures and the initial estimates have the same expected error.This is because no node is more important than another.While T-SIZE is an important improvement over state-of-the-

art, we believe that it could further be improved by makingit continuous – i.e. able to continuously provide the estimatewithout periodic restarting. This is the subject of future work.

REFERENCES[1] J. Li, J. Stribling, R. Morris, and M. F. Kaashoek, “Bandwidth-efficient

management of DHT routing tables,” in Proceedings of the 2nd Sym-posium on Networked Systems Design and Implementation (NSDI’05).Boston, MA: USENIX, May 2005.

[2] I. Stoica, R. Morris, D. Liben-Nowell, D. R. Karger, M. F. Kaashoek,F. Dabek, and H. Balakrishnan, “Chord: a scalable peer-to-peer lookupprotocol for internet applications,” IEEE/ACM Trans. on Networking(TON), vol. 11, no. 1, pp. 17–32, 2003.

[3] P. B. Godfrey and I. Stoica, “Heterogeneity and Load Balance inDistributed Hash Tables,” in Proceedings of the 24th Joint Conf. of theIEEE Computer and Communications Societies (INFOCOM’05), Miami,FL, Mar. 2005, pp. 596–606.

[4] A. Rao, K. Lakshminarayanan, S. Surana, R. M. Karp, and I. Stoica,“Load Balancing in Structured P2P Systems,” in Proceedings of the 2ndInternational Workshop on Peer-to-Peer Systems (IPTPS’03), ser. LNCS,vol. 2735, Berkeley, CA, 2003, pp. 68–79.

[5] A. J. Demers et al., “Epidemic algorithms for replicated databasemaintenance,” in Proceedings of the 6th ACM Symposium on Principlesof Distributed Computing Systems (PODC’87), 1987, pp. 1–12.

[6] A. Fernandez, V. Gramoli, E. Jimenez, A.-M. Kermarrec, and M. Raynal,“Distributed slicing in dynamic systems,” in Proceedings of the 27th In-ternational Conference on Distributed Computing Systems (ICDCS’07).Toronto, Ontario, Canada: IEEE Computer Society, 2007.

10-410-310-210-1100101102103

0 0.2 0.4 0.6 0.8 1

Erro

r (%

)

Failure probability per second per node (%)

T-SizeAverage

Fig. 6. Accuracy under churn.

0

20

40

60

80

100

0 5 10 15 20

Erro

r (%

)

Message losses (%)

T-SizeAverage

Fig. 7. Accuracy under message losses.

[7] A. Montresor and R. Zandonati, “Absolute slicing in peer-to-peer sys-tems,” in Proceedings of the 5th International Workshop on Hot Topicsin Peer-to-Peer Systems (HotP2P’08), Miami, FL, Apr. 2008.

[8] E. L. Merrer, A.-M. Kermarrec, and L. Massoulie, “Peer to peersize estimation in large and dynamic networks: A comparative study,”in Proceedings of the 15th IEEE International Symposium on HighPerformance Distributed Computing (HPDC’06), 2006, pp. 7–17.

[9] D. Kostoulas, D. Psaltoulis, I. Gupta, K. Birman, and A. J. Demers, “De-centralized schemes for size estimation in large and dynamic groups,”in Proceedings of the 4th IEEE International Symposium on NetworkComputing and Applications (NCA’05), 2005, pp. 41–48.

[10] L. Massoulie, E. L. Merrer, A.-M. Kermarrec, and A. J. Ganesh, “Peercounting and sampling in overlay networks: random walk methods,” inProceedings of the 25th ACM Symposium on Principles of DistributedComputing (PODC’06), 2006, pp. 123–132.

[11] M. Jelasity, A. Montresor, and O. Babaoglu, “Gossip-based aggregationin large dynamic networks,” ACM Trans. Comput. Syst., vol. 23, no. 1,pp. 219–252, Aug. 2005.

[12] D. Malkhi, M. Naor, and D. Ratajczak, “Viceroy: A scalable anddynamic emulation of the butterfly,” in Proceedings of the 21st ACMSymposium on Principles of Distributed Computing (PODC’02). NewYork, NY: ACM Press, 2002.

[13] A. R. Bharambe, M. Agrawal, and S. Seshan, “Mercury: SupportingScalable Multi-Attribute Range Queries,” in Proceedings of the ACMSIGCOMM 2004 Symposium on Communication, Architecture, andProtocols. Portland, OR: ACM Press, March 2004, pp. 353–366.

[14] K. Horowitz and D. Malkhi, “Estimating network size from localinformation,” Inform. Process. Lett., vol. 88, pp. 237–243, 2003.

[15] M. Jelasity, A. Montresor, and O. Babaoglu, “T-Man: Gossip-based fastoverlay topology construction,” Comput. Netw., 2009, to appear.

[16] M. Jelasity, S. Voulgaris, R. Guerraoui, A.-M. Kermarrec, and M. vanSteen, “Gossip-based peer sampling,” ACM Trans. Comput. Syst.,vol. 25, no. 3, p. 8, 2007.

[17] M. Jelasity, A. Montresor, G. P. Jesi, and S. Voulgaris, “The Peersimsimulator,” http://peersim.sf.net.

[18] K. P. Gummadi, S. Saroiu, and S. D. Gribble, “King: Estimating latencybetween arbitrary internet end hosts,” in Proceedings of the InternetMeasurement Workshop (SIGCOMM IMW), 2002.

Page 176: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 153

Accuracy – w.r.t. parameter Precision

10-610-510-410-310-210-1100

10-810-710-610-510-410-3405060708090100110120

Erro

r (%

)

Conv

erge

nce

Tim

e (s

)

Precision

Error of max estimateError of min estimates

Convergence time

Fig. 2. Evaluation of parameter precision .

10-5

10-4

10-3

10-2

10-1

1 2 3 4 5 6 7 8 9405060708090100110120

Erro

r (%

)

Conv

erge

nce

Tim

e (s

)

Inactive

Error of max estimateError of min estimate

Convergence time

Fig. 3. Evaluation of parameter inactive.

of 12 bytes (64 bits for the random identifier and 32 bits forthe IP address); thus, the total size of each T-MAN message is20+12∗msgsize bytes. Each message in AVERAGE is composedof just one 64 bit value, so the total size is 20+8 = 28 bytes.

B. Failure-free experimentsThe first set of experiments is meant to evaluate how the er-

ror can be reduced by varying precision and inactive , in orderto fix them for the subsequent simulations. In Fig. 2, precisionvaries between 10−3 and 10−8, while in Fig. 3, inactive variesbetween 2 and 8. As expected, the error level (shown as apercentage on the size of the network in the figures) decreasesin correspondence of larger values of inactive and smallvalues of precision; unfortunately, the convergence time growslinearly, so we fixed precision = 10−5 and inactive = 3 asa trade-off between our metrics. Note that with these values,the error is around 0.01%.In the second set of experiments, we want to test how

overhead and convergence time are related to each other.Fig. 4 has been obtained by varying two parameters, msgsizebetween 2 and 20, and δc between 0.1s and 1.0s. By plottingthe convergence time on the x-axis and the overhead per nodeon the y-axis, we have been able to highlight the trade-offbetween these two metrics - the faster you want to go, thelarger overhead you have to pay. To match dots with theirparameter setting, the same set of experiments is plotted twicewith different gray-scale coding. On the top figure, the codingshown on the right bar corresponds to the cycle length; thesmaller the cycle-length, the faster the speed (as expected).But note that the smallest simulated cycle length (0.1s) is

2 4 6 8 10 12 14 16 18 20Parameter: message size

20 25 30 35 40 45 50 55 60 65Convergence Time (s)

3

4

5

6

7

8

9

10

Ove

rhea

d pe

r nod

e (k

B)

0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1Parameter: cycle length

3

4

5

6

7

8

9

10

Ove

rhea

d pe

r nod

e (k

B)

Fig. 4. Trade-off between overhead and convergence time

not shown, because none of the experiments have been ableto converge in less than 200 cycles (the time limit of oursimulations); furthermore, even 0.2s is not a good choice,given that the associated dark dots are scattered between 35and 45 seconds. On the bottom figure, the coding correspondsto the message size; small message sizes tend to reduce thetotal overhead, but not the very small ones. In the rest of ourexperiments, we selected two fairly conservative values, i.e.δc = 1s and msgsize = 10.The log-log plot of Fig. 5 shows the scalability of T-SIZE

and compare it with AVERAGE. T-SIZE scales logarithmicallyfor sizes included in [210, 218], and the convergence time scalesbetter with T-SIZE rather than AVERAGE; the price to be payedis a larger (but still reasonable) overhead.

C. RobustnessWe are particularly interested in evaluating these metrics

in an environment subject to churn and message loss; ourprotocol has proven to be extremely robust in these cases.Fig. 6 show the behavior of the system under a disruptivescenario where up to 1% of the nodes leave/crash at eachsecond. This corresponds to an expected lifetime of 99s –an insane level of churn, much larger than measured churnlevels which are around 0.01%. Still, our protocol manages tokeep the error below 7%, with most of the dots below 2%.Compared with AVERAGE, we note a strong error reduction.Fig. 7 shows the behavior of the protocol in case of

message losses. The protocol is sensitive to high levels oflosses; this is because the loss of the reply message in anaggregation exchange causes an asymmetric update of the localvalues: one is changed, the other not. Nevertheless, for limitedamounts of message loss (less than 5%), the protocol remainsadequately accurate and its behavior is better than AVERAGE,which performs fairly bad even with small levels of messagelosses.

Page 177: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 154

Robustness

0.0

1.0

2.0

3.0

4.0

5.0

210 211 212 213 214 215 216 217 218

Ove

rhea

d pe

r nod

e (k

B)

Size

T-SizeAverage

30 35 40 45 50 55 60 65 70 75

Conv

erge

nce

Tim

e (s

)

T-SizeAverage

Fig. 5. Scalability

IV. DISCUSSION AND CONCLUSIONSEpidemic protocols for peer counting have been proposed

by Jelasity et al. in 2005 [11]; the idea was to use AVERAGE,initializing all nodes to 0, apart from one node set to 1 (theinitiator). The network size n could be easily derived from thecomputed average 1/n. The problem of this approach was itssensitivity to failures; in the first phases of the computation,the failure of the initiator or its neighbors nodes could easilydouble the estimate. Furthermore, the initial estimate at thenodes were exceedingly inaccurate. T-SIZE is more robust tofailures and the initial estimates have the same expected error.This is because no node is more important than another.While T-SIZE is an important improvement over state-of-the-

art, we believe that it could further be improved by makingit continuous – i.e. able to continuously provide the estimatewithout periodic restarting. This is the subject of future work.

REFERENCES[1] J. Li, J. Stribling, R. Morris, and M. F. Kaashoek, “Bandwidth-efficient

management of DHT routing tables,” in Proceedings of the 2nd Sym-posium on Networked Systems Design and Implementation (NSDI’05).Boston, MA: USENIX, May 2005.

[2] I. Stoica, R. Morris, D. Liben-Nowell, D. R. Karger, M. F. Kaashoek,F. Dabek, and H. Balakrishnan, “Chord: a scalable peer-to-peer lookupprotocol for internet applications,” IEEE/ACM Trans. on Networking(TON), vol. 11, no. 1, pp. 17–32, 2003.

[3] P. B. Godfrey and I. Stoica, “Heterogeneity and Load Balance inDistributed Hash Tables,” in Proceedings of the 24th Joint Conf. of theIEEE Computer and Communications Societies (INFOCOM’05), Miami,FL, Mar. 2005, pp. 596–606.

[4] A. Rao, K. Lakshminarayanan, S. Surana, R. M. Karp, and I. Stoica,“Load Balancing in Structured P2P Systems,” in Proceedings of the 2ndInternational Workshop on Peer-to-Peer Systems (IPTPS’03), ser. LNCS,vol. 2735, Berkeley, CA, 2003, pp. 68–79.

[5] A. J. Demers et al., “Epidemic algorithms for replicated databasemaintenance,” in Proceedings of the 6th ACM Symposium on Principlesof Distributed Computing Systems (PODC’87), 1987, pp. 1–12.

[6] A. Fernandez, V. Gramoli, E. Jimenez, A.-M. Kermarrec, and M. Raynal,“Distributed slicing in dynamic systems,” in Proceedings of the 27th In-ternational Conference on Distributed Computing Systems (ICDCS’07).Toronto, Ontario, Canada: IEEE Computer Society, 2007.

10-410-310-210-1100101102103

0 0.2 0.4 0.6 0.8 1

Erro

r (%

)

Failure probability per second per node (%)

T-SizeAverage

Fig. 6. Accuracy under churn.

0

20

40

60

80

100

0 5 10 15 20

Erro

r (%

)

Message losses (%)

T-SizeAverage

Fig. 7. Accuracy under message losses.

[7] A. Montresor and R. Zandonati, “Absolute slicing in peer-to-peer sys-tems,” in Proceedings of the 5th International Workshop on Hot Topicsin Peer-to-Peer Systems (HotP2P’08), Miami, FL, Apr. 2008.

[8] E. L. Merrer, A.-M. Kermarrec, and L. Massoulie, “Peer to peersize estimation in large and dynamic networks: A comparative study,”in Proceedings of the 15th IEEE International Symposium on HighPerformance Distributed Computing (HPDC’06), 2006, pp. 7–17.

[9] D. Kostoulas, D. Psaltoulis, I. Gupta, K. Birman, and A. J. Demers, “De-centralized schemes for size estimation in large and dynamic groups,”in Proceedings of the 4th IEEE International Symposium on NetworkComputing and Applications (NCA’05), 2005, pp. 41–48.

[10] L. Massoulie, E. L. Merrer, A.-M. Kermarrec, and A. J. Ganesh, “Peercounting and sampling in overlay networks: random walk methods,” inProceedings of the 25th ACM Symposium on Principles of DistributedComputing (PODC’06), 2006, pp. 123–132.

[11] M. Jelasity, A. Montresor, and O. Babaoglu, “Gossip-based aggregationin large dynamic networks,” ACM Trans. Comput. Syst., vol. 23, no. 1,pp. 219–252, Aug. 2005.

[12] D. Malkhi, M. Naor, and D. Ratajczak, “Viceroy: A scalable anddynamic emulation of the butterfly,” in Proceedings of the 21st ACMSymposium on Principles of Distributed Computing (PODC’02). NewYork, NY: ACM Press, 2002.

[13] A. R. Bharambe, M. Agrawal, and S. Seshan, “Mercury: SupportingScalable Multi-Attribute Range Queries,” in Proceedings of the ACMSIGCOMM 2004 Symposium on Communication, Architecture, andProtocols. Portland, OR: ACM Press, March 2004, pp. 353–366.

[14] K. Horowitz and D. Malkhi, “Estimating network size from localinformation,” Inform. Process. Lett., vol. 88, pp. 237–243, 2003.

[15] M. Jelasity, A. Montresor, and O. Babaoglu, “T-Man: Gossip-based fastoverlay topology construction,” Comput. Netw., 2009, to appear.

[16] M. Jelasity, S. Voulgaris, R. Guerraoui, A.-M. Kermarrec, and M. vanSteen, “Gossip-based peer sampling,” ACM Trans. Comput. Syst.,vol. 25, no. 3, p. 8, 2007.

[17] M. Jelasity, A. Montresor, G. P. Jesi, and S. Voulgaris, “The Peersimsimulator,” http://peersim.sf.net.

[18] K. P. Gummadi, S. Saroiu, and S. D. Gribble, “King: Estimating latencybetween arbitrary internet end hosts,” in Proceedings of the InternetMeasurement Workshop (SIGCOMM IMW), 2002.

Page 178: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

Absolute slicing

✦ Bibliography✦ A. Montresor and R. Zandonati. Absolute slicing in peer-to-peer systems. In Proc. of

the 5th International Workshop on Hot Topics in Peer-to-Peer Systems (HotP2P'08), Miami, FL, USA, April 2008.

155

Page 179: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 156

Introduction

✦ System model✦ An huge collection of networked nodes (resource pool)✦ Potentially owned/controlled by a single organization that deploys massive services

on them

✦ Examples✦ ISPs that place smart modems / set-top boxes

at their customers' homes✦ BT, France Telecom

✦ Note: similar to current P2P systems, but with some peculiar differences

Page 180: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 157

Introduction: possible scenarios

✦ Multiple-services architecture✦ Nodes must be able to host a large number of services, potentially executed by third-

party entities

✦ On-demand services✦ A subset of the nodes can be leased temporally and

quickly organized into an overlay network

✦ Adaptive resource management ✦ Resource assignments of long-lived services could be adapted based on QoS

requirements and changes in the environment

Page 181: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 158

Overview

✦ What we need to realize those scenarios?✦ Maintain a dynamic membership of the network (peer sampling)✦ Dynamically allocate subset of nodes to applications (slicing)

✦ Start overlays from scratch (bootstrap)✦ Deploy applications on overlays (broadcast)✦ Monitor applications (aggregation)

✦ This while dealing with massive dynamism✦ Catastrophic failures✦ Variations in QoS requirements (flash crowds)

Page 182: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 159

Architecture: a decentralized OS

Peer sampling service

SlicingService

TopologyBootstrap

MonitoringService Broadcast

Other middleware services (DHTs, indexing, publish-subscribe, etc.)

Applications

Page 183: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 160

The problem

✦ Distributed Slicing✦ Given a distributed collection of nodes, we want to allocate a subset (“slice”) of them

to a specific application, by selecting those that satisfy a given condition over group or node attributes

✦ Ordered Slicing (Fernandez et al., 2007)✦ Return top k% nodes based on some attribute ranking

✦ Absolute slicing✦ Return k nodes and maintain such allocation in spite of churn

✦ Cumulative slicing✦ Return nodes whose attribute total sum correspond to a

target value

Page 184: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 161

Problem definition

✦ We considere a dynamic collection N of nodes

✦ Each node ni ∈N is provided with an attribute function✦ fi: A → V

✦ Slice S(c,s): a dynamic subset of N such that✦ c is a first-order-logic condition defined over attribute names and values, identifying

the potential member of the slice

✦ s is the desired slice size

✦ Slice quality:

|S(c, s)|− s

s

Page 185: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 162

Problem definition

N Total nodes

P Potential nodes (each node satisfying c)

S Slice nodes (total slice size ~ s)

Page 186: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 163

Issues

✦ What we mean with “return a slice”?✦ We cannot provide each node with a complete view of large scale subset✦ Slice composition may continuously change due to churn

✦ How we compute the slice size?✦ without a central service that does the counting?

✦ How do we inform nodes about the current slice definition?✦ Multiple slices, over different conditions, with potentially changing slice sizes

Page 187: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 164

Gossip to the rescue

✦ Turns out that all services listed so far can be implemented using a gossip approach✦ Peer sampling: continuously provides uniform random samples over a dynamic large

collection of nodes✦ random samples can be used to build other gossip protocols✦ side-effect: strongly connected random graph

✦ Aggregation: compute aggregate information (average, sum, total size, etc.) over large collection of nodes

✦ we are interested in size estimation✦ Broadcast: disseminate information

✦ Gossip beyond dissemination✦ Information is not simply exchanged, but also manipulated

Page 188: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 165

Architecture of the absolute slicing protocol

Peer Sampling

Peer Sampling

Peer Sampling

Aggregation

Aggregation

N

P

S

Broadcast

ApplicationProtocol

Page 189: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 166

The slicing algorithm

✦ Total group✦ All nodes participate in the peer sampling protocol to maintain the total group

✦ Potential group✦ Nodes that satisfy the condition c join the potential group peer sampling

✦ Means: inject their identifier into message exchanged atthe 2nd peer sampling layer

✦ Aggregation✦ Estimate the size of the potential group size(P)

Page 190: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 167

The slicing algorithm

✦ Slice group✦ Nodes that “believe to belong” to the slice join the slice peer sampling

✦ Means: inject their identifier into messages exchanged at the 3rd peer sampling layer

✦ Aggregation✦ Estimate the size of the slice size(S)

✦ Nodes “believe to belong” or not to the slice✦ join the slice with prob. (s-size(S)) / (size(P)-size(S))✦ leave the slice with prob. (size(S)-s) / size(S)

Page 191: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 168

Experimental results: actual slice size

Page 192: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 169

Experimental results: churn 10-4 nodes/s

Page 193: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 170

Experimental results: variable churn

Page 194: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 171

Experimental results: message losses

Page 195: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 172

Slicing - conclusion

✦ Absolute slicing protocol ✦ Extremely robust (high level of churn, message losses)✦ Low cost (several layers, but each requiring few bytes per sec)

✦ Large precision

✦ The message✦ Gossip can solve many problems in a robust way

✦ Customizable to many needs

✦ What's next?✦ Cumulative slicing:

✦ very similar, but it's a knapsack problem

Page 196: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

Function optimization

✦ Bibliography✦ M. Biazzini, A. Montresor, and M. Brunato. Towards a decentralized architecture for

optimization. In Proc. of the 22nd IEEE International Parallel and Distributed Processing Symposium (IPDPS'08), Miami, FL, USA, April 2008.

✦ Additional bibliography✦ B. Bánhelyi, M. Biazzini, A. Montresor, and M. Jelasity. Peer-to-peer optimization in

large unreliable networks with branch-and-bound and particle swarms. In Applications of Evolutionary Computing, Lecture Notes in Computer Science, pages 87-92. Springer, Jul 2009.

✦ M. Biazzini, B. Bánhelyi, A. Montresor, and M. Jelasity. Distributed hyper-heuristics for real parameter optimization. In Proceedings of the 11th Genetic and Evolutionary Computation Conference (GECCO'09), pages 1339-1346, Montreal, Québec, Canada, July 2009.

173

Page 197: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 174

Particle swarm optimization

✦ Input:✦ A multi-dimensional function✦ A multi-dimensional space to be inspected

✦ Output:✦ The point where the minimum is located, together with its value

✦ Approximation problem

Page 198: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 175

Particle swarm optimization

✦ A solver is a swarm of particles spread in the domain of the objective function

✦ Particles evaluate the objective function in a point p, looking for the minimum

✦ Each particle knows the best points✦ found by itself (bp) ✦ found by someone in the swarm (bg)

✦ Each particle updates its position p as follows:✦ v = v + c1 * rand() * (bp - p) + c2 * rand() * (bg - p)✦ p = p + v

Page 199: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 176

Particle swarm optimization

✦ Modular architecture for distributed optimization:

✦ The topology service (NEWSCAST)✦ creates and maintains an overlay topology

✦ The function optimization service (D-PSO)✦ evaluates the function over a set of points

✦ Local/remote history driven choices

✦ The coordination service (gossip algorithm)✦ determines the selection of points to be evaluated

✦ spread information about the global optimum

Page 200: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 177

Particle swarm optimization

✦ Communication failures are harmless✦ Losses of messages just slow down the spreading of (correct) information

✦ Churning is inoffensive✦ Nodes can join and leave arbitrarily and this does not affect the consistency of the

overall computation

Page 201: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 178

Scalability

Page 202: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 179

Gossip Lego, reloaded

✦ The baseplate✦ Peer sampling

✦ The bricks✦ Slicing (group management)

✦ Topology bootstrap✦ Aggregation (monitoring)

✦ Load balancing (based on aggregation)

✦ Applications✦ Function optimization

✦ P2P video streaming✦ Social networking

Page 203: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor 180

Conclusions

✦ We only started to discover the power of gossip✦ Many other problems can be solved

✦ The right tool for✦ large-scale

✦ dynamic systems

✦ Caveat emptor: security✦ We only started to consider the problems related to security in open systems

Page 204: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

Shameless advertisement

✦ PeerSim - A peer-to-peer simulator✦ Written in Java✦ Specialized for epidemic protocols

✦ Configurations based on textual file✦ Light and fast core

✦ Some statistics✦ 15.000+ downloads✦ 150+ papers written with PeerSim

181

PeerSim: A Peer-to-Peer Simulator[Introduction] [People] [Download] [Documentation] [Publications] [Peersim Extras]

[Additional Code]

Introduction top

Peer-to-peer systems can be of a very large scale such as millions of nodes, whichtypically join and leave continously. These properties are very challenging to deal with.Evaluating a new protocol in a real environment, especially in its early stages ofdevelopment, is not feasible.

PeerSim has been developed with extreme scalability and support for dynamicity in mind.We use it in our everyday research and chose to release it to the public under the GPLopen source license. It is written in Java and it is composed of two simulation engines, asimplified (cycle-based) one and and event driven one. The engines are supported bymany simple, extendable, and pluggable components, with a flexible configurationmechanism.

The cycle-based engine, to allow for scalability, uses some simplifying assumptions, suchas ignoring the details of the transport layer in the communication protocol stack. Theevent-based engine is less efficient but more realistic. Among other things, it supportstransport layer simulation as well. In addition, cycle-based protocols can be run by theevent-based engine too.

PeerSim started under EU projects BISON and DELIS DELIS. The PeerSim developmentin Trento (Alberto Montresor, Gian Paolo Jesi) is now partially supported by theNapa-Wine project.

People top

The main developers of PeerSim are:

Márk Jelasity, Alberto Montresor,

Gian Paolo Jesi, Spyros Voulgaris

Other contributors and testers (in alphabetical order):

Stefano Arteconi

David Hales

Andrea Marcozzi

Fabio Picconi

Page 205: Gossip protocols for large-scale distributed systemssbrc2010.inf.ufrgs.br/resources/presentations/tutorial/tutorial... · Gossip protocols for large-scale distributed systems ...

© Alberto Montresor

Thanks

✦ My co-authors:✦ Mark, Ozalp, Gian Paolo, Marco, Roberto, Ali, Maarten, Mauro, Balazs

✦ For some slides:✦ Spyros

✦ Those who invited me:✦ Marinho, Luciano and Lisandro

✦ And finally:✦ You for listening!

182