84
April 10,  2012 Epidemic Algorithms – Amir H. Payberah 1 Epidemic Algorithms Amir H. Payberah ([email protected])

Gossip

  • Upload
    iam

  • View
    215

  • Download
    1

Embed Size (px)

DESCRIPTION

Rumor Mongering Operation Babbles Echelon NSA Testing Babbles

Citation preview

Page 1: Gossip

April 10,  2012 Epidemic Algorithms – Amir H. Payberah 1

Epidemic Algorithms

Amir H. Payberah ([email protected])

Page 2: Gossip

Epidemic Algorithms – Amir H. Payberah 2April 10,  2012

● Motivations Existing reliable protocols have scalability problems.

Randomized protocols may have a smaller overhead.

Trade­off between reliability and scalability.

● Can be applied To large­scale distributed systems (millions of nodes).

When full reliability is not required.

Introduction

Page 3: Gossip

Epidemic Algorithms – Amir H. Payberah 3April 10,  2012

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

● How does it work?

Initially, a single individual is infective.

Individuals get in touch with each other, spreading the update.

● Our goal is to spread the infection (update) as fast as possible!

Epidemic Protocols

Page 4: Gossip

Epidemic Algorithms – Amir H. Payberah 4April 10,  2012

● Anti­entropy

● Rumor mongering

Two Styles of Epidemic Protocols

Page 5: Gossip

Epidemic Algorithms – Amir H. Payberah 5April 10,  2012

● Each peer p periodically contacts a random partner q selected from the current population.

● Then, p and q engage in an information exchange protocol, where updates known to p but not to q are transferred from p to q (push), or viceversa (pull), or in both direction (push­pull).

Anti­entropy

Page 6: Gossip

Epidemic Algorithms – Amir H. Payberah 6April 10,  2012

● Peers are initially ignorant.

● When an update is learned by a peer, it becomes a hot rumor.

● While a peer holds a hot rumor, it periodically chooses a random peer from the current population and sends (pushes) the rumor to it.

● Eventually, a node will lose interest in spreading the rumor.

Rumor Mongering

Page 7: Gossip

Epidemic Algorithms – Amir H. Payberah 7April 10,  2012

● Counter vs. Coin

Counter: lose interest after k contacts.

Coin (random): lose interest with probability 1/k.

● Feedback vs. Blind

Feedback: lose interest only if the recipient knows the rumor.

Blind: lose interest regardless of the recipient.

Rumor Mongering: Loss of Interest

Page 8: Gossip

Epidemic Algorithms – Amir H. Payberah 8April 10,  2012

● Participants’ load is independent of size

● Information spreads in log(system size) time.

% infe

c ted

0.0

1.0

Time →

Epidemic Protocols Scale Very Nicely

Page 9: Gossip

Epidemic Algorithms – Amir H. Payberah 9April 10,  2012

● Aggregation

● Membership management (Cyclon)

● Topology management (T­man)

● Etc.

Use of Epidemic Protocols

Page 10: Gossip

April 10,  2012 Epidemic Algorithms – Amir H. Payberah 10

Aggregation

Page 11: Gossip

Epidemic Algorithms – Amir H. Payberah 11April 10,  2012

● Aggregation is a common name for a set of functions that provide a summary of some global system property. 

● It allows local access to global information, in order to simplify the task of controlling, monitoring, and optimization in distributed applications. 

● Examples of aggregation functions:

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.

Aggregation

Page 12: Gossip

Epidemic Algorithms – Amir H. Payberah 12April 10,  2012

// active threaddo forever wait(T time units) q = SelectPeer() send S to q recv Sq from q

S = Update(S,Sq)

// passive threaddo forever recv Sp from p send S to p S = Update(S,Sp)

A Generic Aggregation Framework

Page 13: Gossip

Epidemic Algorithms – Amir H. Payberah 13April 10,  2012

● Local state maintained by nodes:  a real number representing the value to be averaged.

● selectPeer() performs a random selection among the set of current nodes.

● update(sp, sq) Avg: return (sp+sq)/2

Max: return max(sp,sq)

Some Comments

Page 14: Gossip

Epidemic Algorithms – Amir H. Payberah 14April 10,  2012

164

36

8

102

Average Aggregation (1/5)

Page 15: Gossip

Epidemic Algorithms – Amir H. Payberah 15April 10,  2012

164

36

8

102

Average Aggregation (2/5)

Page 16: Gossip

Epidemic Algorithms – Amir H. Payberah 16April 10,  2012

164

36

8

66

(10 + 2) / 2 = 6

Average Aggregation (3/5)

Page 17: Gossip

Epidemic Algorithms – Amir H. Payberah 17April 10,  2012

164

36

8

66

Average Aggregation (4/5)

Page 18: Gossip

Epidemic Algorithms – Amir H. Payberah 18April 10,  2012

1010

36

8

66

(16 + 4) / 2 = 10

Average Aggregation (5/5)

Page 19: Gossip

Epidemic Algorithms – Amir H. Payberah 19April 10,  2012

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

● After each exchange the variance is reduced.

Some Comments

Page 20: Gossip

Epidemic Algorithms – Amir H. Payberah 20April 10,  2012

Illustration of Averaging

Page 21: Gossip

Epidemic Algorithms – Amir H. Payberah 21April 10,  2012

● Any ideas?

Network Size Estimation

Page 22: Gossip

Epidemic Algorithms – Amir H. Payberah 22April 10,  2012

● Any ideas?

● All nodes set their states to 0.

● The initiator sets its state to 1 and starts gossiping for the average.

● Eventually (after predefined k rounds) all nodes converge to the avg=1/N.

Network Size Estimation

Page 23: Gossip

April 10,  2012 Epidemic Algorithms – Amir H. Payberah 23

Membership Management

Page 24: Gossip

Epidemic Algorithms – Amir H. Payberah 24April 10,  2012

● In a gossip­based protocol, each node in the system periodically exchanges information with a subset of peers.

● The choice of this subset is crucial.

● Ideally, the peers should be selected following a uniform random sample of all nodes currently in the system.

Membership Management

Page 25: Gossip

Epidemic Algorithms – Amir H. Payberah 25April 10,  2012

● Each node may be assumed to know every other node in the system.

● However, providing each node with a complete membership table from which a random sample can be drawn, is unrealistic in a large­scale dynamic system.

Achieving a Uniform Random Sample

Page 26: Gossip

Epidemic Algorithms – Amir H. Payberah 26April 10,  2012

● Peer sampling

● Every node maintains a relatively small local membership table that provides a partial view on the complete set of nodes.

● Periodically refreshes the table using a gossiping procedure.

An Alternative Solution

Page 27: Gossip

Epidemic Algorithms – Amir H. Payberah 27April 10,  2012

// active threaddo forever wait(T time units) q = view.SelectPeer() buf = ((myAddress, 0)) view.permute() move oldest H items to the end of view buf.append(view.head(c/2-1)) send buf to q recv bufq from q view.select(c, H, S, bufq) view.increaseAge()

Peer Sampling Generic Framework (1/3)

Page 28: Gossip

Epidemic Algorithms – Amir H. Payberah 28April 10,  2012

// passive threaddo forever recv bufp from p buf = ((myAddress, 0)) view.permute() move oldest H items to the end of view buf.append(view.head(c/2-1)) send buf to p view.select(c, H, S, bufp) view.increaseAge()

Peer Sampling Generic Framework (2/3)

Page 29: Gossip

Epidemic Algorithms – Amir H. Payberah 29April 10,  2012

// view select methodmethod view.select(c, H, S, bufp) view.append(bufp) view.removeDuplicates() view.removeOldItems(min(H, view.size-c)) view.removeHead(min(S, view.size-c)) view.removeAtRandom(view.size-c)

Peer Sampling Generic Framework (3/3)

Page 30: Gossip

Epidemic Algorithms – Amir H. Payberah 30April 10,  2012

● Peer Selection

Rand: uniform random

Tail: highest age

● View Propagation

Push

Push­Pull

● View Selection

Blind: H = 0, S = 0

Healer: H = c / 2

Swapper: H = 0, S = c / 2

Design Space

Peer Selection

View Propagation

View Selection

Rand

Tail

Push Push-Pull

Blind

Heale

r

Swappe

r

Page 31: Gossip

Epidemic Algorithms – Amir H. Payberah 31April 10,  2012

Gossip­based Peer Sampling Protocol (1/7)

n1n2

n3

n4n5

n6n7

n8

n9

n10

n11

Page 32: Gossip

Epidemic Algorithms – Amir H. Payberah 32April 10,  2012

Gossip­based Peer Sampling Protocol (2/7)

n1n2

n3

n4n5

n6n7

n8

n9

n10

n11

n8n7n10n5

n1n6n3n11

Page 33: Gossip

Epidemic Algorithms – Amir H. Payberah 33April 10,  2012

Gossip­based Peer Sampling Protocol (3/7)

n1n2

n3

n4n5

n6n7

n8

n9

n10

n11

n8n7n10n5

n1n6n3n11

shuffle request

n8n7

Page 34: Gossip

Epidemic Algorithms – Amir H. Payberah 34April 10,  2012

Gossip­based Peer Sampling Protocol (4/7)

n1n2

n3

n4n5

n6n7

n8

n9

n10

n11

n8n7n10n5

n1n6n3n11

shuffle response

n1n6

n8n7

Page 35: Gossip

Epidemic Algorithms – Amir H. Payberah 35April 10,  2012

Gossip­based Peer Sampling Protocol (5/7)

n1n2

n3

n4n5

n6n7

n8

n9

n10

n11

n8n7n10n5

n1n6n3n11

n1n6

n8n7

Page 36: Gossip

Epidemic Algorithms – Amir H. Payberah 36April 10,  2012

Gossip­based Peer Sampling Protocol (6/7)

n1n2

n3

n4n5

n6n7

n8

n9

n10

n11

n8n7n10n5

n1n3n6n11

n1n6

n8n7

UpdateState

UpdateState

Page 37: Gossip

Epidemic Algorithms – Amir H. Payberah 37April 10,  2012

Gossip­based Peer Sampling Protocol (7/7)

n1n2

n3

n4n5

n6n7

n8

n9

n10

n11

n8n7n10n5

n1n3n3n11

n1n6

n8n7

Page 38: Gossip

Epidemic Algorithms – Amir H. Payberah 38April 10,  2012

● Peer Selection

Rand: uniform random

Tail: highest age

● View Propagation

Push

Push­Pull

● View Selection

Blind: H = 0, S = 0

Healer: H = c / 2

Swapper: H = 0, S = c / 2

Newscast as a Peer Sampling Example

Peer Selection

View Propagation

View Selection

Rand

Tail

Push Push-Pull

Blind

Heale

r

Swappe

r

Page 39: Gossip

Epidemic Algorithms – Amir H. Payberah 39April 10,  2012

Newscast (1/7)

n1

n3

n5

n6n7

n10

n11Id, timen7, 9n10, 16n5, 12

Id, timen1, 7n3, 14n6, 10

Page 40: Gossip

Epidemic Algorithms – Amir H. Payberah 40April 10,  2012

Newscast (2/7)

n1

n3

n5

n6n7

n10

n11Id, timen7, 9n10, 16n5, 12

● Pick a random peer from my view

Id, timen1, 7n3, 14n6, 10

Page 41: Gossip

Epidemic Algorithms – Amir H. Payberah 41April 10,  2012

Newscast (3/7)

n1

n3

n5

n6n7

n10

n11Id, timen7, 9n10, 16n5, 12

● Pick a random peer from my view

● Send each other view + own fresh link

Id, timen1, 7n3, 14n6, 10

Id, timen7, 9n10, 16n5, 12

Id, timen11, 20

Page 42: Gossip

Epidemic Algorithms – Amir H. Payberah 42April 10,  2012

Newscast (4/7)

n1

n3

n5

n6n7

n10

n11Id, timen7, 9n10, 16n5, 12

● Pick a random peer from my view

● Send each other view + own fresh link

Id, timen1, 7n3, 14n6, 10

Id, timen7, 9n10, 16n5, 12

Id, timen1, 7n3, 14n6, 10

Id, timen11, 20

Id, timen5, 20

Page 43: Gossip

Epidemic Algorithms – Amir H. Payberah 43April 10,  2012

Newscast (5/7)

n1

n3

n5

n6n7

n10

n11Id, timen7, 9n10, 16n5, 12

● Pick a random peer from my view

● Send each other view + own fresh link

● Keep c freshest links (remove own info and duplicates)

Id, timen1, 7n3, 14n6, 10

Id, timen7, 9n10, 16n5, 12

Id, timen1, 7n3, 14n6, 10

Id, timen11, 20

Id, timen5, 20

Page 44: Gossip

Epidemic Algorithms – Amir H. Payberah 44April 10,  2012

Newscast (6/7)

n1

n3

n5

n6n7

n10

n11Id, timen7, 9n10, 16n5, 12

● Pick a random peer from my view

● Send each other view + own fresh link

● Keep c freshest links (remove own info and duplicates)

Id, timen1, 7n3, 14n6, 10

Id, timen7, 9n10, 16n5, 12

Id, timen1, 7n3, 14n6, 10

Id, timen11, 20

Id, timen5, 20

Page 45: Gossip

Epidemic Algorithms – Amir H. Payberah 45April 10,  2012

Newscast (7/7)

n1

n3

n5

n6n7

n10

n11Id, timen3, 14n10, 16n5, 20

● Pick a random peer from my view

● Send each other view + own fresh link

● Keep c freshest links (remove own info and duplicates)

Id, timen3, 14n10, 16n11, 20

Page 46: Gossip

Epidemic Algorithms – Amir H. Payberah 46April 10,  2012

● Peer Selection

Rand: uniform random

Tail: highest age

● View Propagation

Push

Push­Pull

● View Selection

Blind: H = 0, S = 0

Healer: H = c / 2

Swapper: H = 0, S = c / 2

Cyclon as a Peer Sampling Example

Peer Selection

View Propagation

View Selection

Rand

Tail

Push Push-Pull

Blind

Heale

r

Swappe

r

Page 47: Gossip

Epidemic Algorithms – Amir H. Payberah 47April 10,  2012

Cyclon (1/5)

n1

n3

n5

n6n7

n10

n11Id, timen7, 9n10, 16n5, 4

Id, timen1, 7n3, 14n6, 10

Page 48: Gossip

Epidemic Algorithms – Amir H. Payberah 48April 10,  2012

Cyclon (2/5)

n1

n3

n5

n6n7

n10

n11Id, timen7, 9n10, 16n5, 4

Id, timen1, 7n3, 14n6, 10

● Pick the oldest peer from my view and remove it from the view.

Page 49: Gossip

Epidemic Algorithms – Amir H. Payberah 49April 10,  2012

Cyclon (3/5)

n1

n3

n5

n6n7

n10

n11Id, timen7, 9n10, 16 Id, time

n1, 7n3, 14n6, 10

● Pick the oldest peer from my view and remove it from the view.

● Exchange some of the peers in neighbours (swap policy)

● The active peer sends its fresh address

Id, timen10, 9n11, 20

Page 50: Gossip

Epidemic Algorithms – Amir H. Payberah 50April 10,  2012

Cyclon (4/5)

n1

n3

n5

n6n7

n10

n11Id, timen7, 9n10, 16 Id, time

n1, 7n3, 14n6, 10

● Pick the oldest peer from my view and remove it from the view.

● Exchange some of the peers in neighbours (swap policy). 

● The active peer sends its fresh address

Id, timen10, 9n11, 20

Id, timen3, 14n6, 10

Page 51: Gossip

Epidemic Algorithms – Amir H. Payberah 51April 10,  2012

Cyclon (5/5)

n1

n3

n5

n6n7

n10

n11Id, timen7, 9n3, 14n6, 10

Id, timen1, 7n10, 9n11, 20

● Pick the oldest peer from my view and remove it from the view.

● Exchange some of the peers in neighbours (swap policy). 

● The active peer sends its fresh address

Page 52: Gossip

Epidemic Algorithms – Amir H. Payberah 52April 10,  2012

Cyclon Properties: Connectivity

● In a fail­free environment, no peer becomes disconnected in the undirected graph.

● Pointers move, so peers change from being neighbor of one peer to being the neighbor of another peer

Page 53: Gossip

Epidemic Algorithms – Amir H. Payberah 53April 10,  2012

Cyclon Properties: Convergence

● Starting from a state, where peers are connected in a chain.

● Convergence is defined by having the same average path length as a random graph.

Page 54: Gossip

Epidemic Algorithms – Amir H. Payberah 54April 10,  2012

Cyclon Properties: Clustering Coefficient

● Clustering Coefficient (of a node): the ratio of existing links among the node’s neighbors over the total number of possible links among them.

● Shows what percentage the neighbors of a node are also neighbors among themselves.

Page 55: Gossip

Epidemic Algorithms – Amir H. Payberah 55April 10,  2012

Cyclon Properties: lndegree Distribution

Page 56: Gossip

April 10,  2012 Epidemic Algorithms – Amir H. Payberah 56

Topology Management

Page 57: Gossip

Epidemic Algorithms – Amir H. Payberah 57April 10,  2012

T­Man

● T­man is a protocol that can construct and maintain any topology with the help of a ranking function.

● The ranking function orders any set of nodes according to their desirability to be neighbors of a given node

Page 58: Gossip

Epidemic Algorithms – Amir H. Payberah 58April 10,  2012

// active threaddo forever wait(T time units) q = view.selectPeer() myDescriptor = (myAddress, myProfile) buf = merge(view, myDescriptor) buf = merge(buf, rnd.view) send buf to q recv bufq from q

buf = merge(bufq,view) view = selectView(buf)

A Generic T­Man Framework (1/2)

Page 59: Gossip

Epidemic Algorithms – Amir H. Payberah 59April 10,  2012

// passive threaddo forever recv bufp from p myDescriptor = (myAddress, myProfile) buf = merge(view, myDescriptor) buf = merge(buf, rnd.view) send buf to p buf = merge(bufp,view) view = selectView(buf)

A Generic T­Man Framework (2/2)

Page 60: Gossip

Epidemic Algorithms – Amir H. Payberah 60April 10,  2012

Some Comments

● SelectPeer Sort all nodes in the view based on ranking. Pick randomly one node from the first half.

● rnd.view provides a random sample of the nodes from the entire network, e.g., using cyclon

● SelectView Sort all nodes in buffer (about double size of the view) Pick out c highest ranked nodes.

Page 61: Gossip

Epidemic Algorithms – Amir H. Payberah 61April 10,  2012

Ranking Function

● Sample ranking functions: Line: d(a, b) = |a – b| Ring: d(a, b) = min(N ­ |a – b|, |a – b|)

Page 62: Gossip

Epidemic Algorithms – Amir H. Payberah 62April 10,  2012

Illustration of T­Man

Page 63: Gossip

April 10,  2012 Epidemic Algorithms – Amir H. Payberah 63

Connectivity Problem

Page 64: Gossip

Epidemic Algorithms – Amir H. Payberah 64April 10,  2012

NAT Environments (1/4)

n1

n2n3

n4

n5

n6

n7

n8

n9

n10

n11

Private node

Public node

shuffle request

Page 65: Gossip

Epidemic Algorithms – Amir H. Payberah 65April 10,  2012

NAT Environments (1/4)

n1

n2n3

n4

n5

n6

n7

n8

n9

n10

n11

Private node

Public node

shuffle response

Page 66: Gossip

Epidemic Algorithms – Amir H. Payberah 66April 10,  2012

NAT Environments (1/4)

n1

n2n3

n4

n5

n6

n7

n8

n9

n10

n11

Private node

Public node

shuffle response

UpdateState

UpdateState

Page 67: Gossip

Epidemic Algorithms – Amir H. Payberah 67April 10,  2012

NAT Environments (1/4)

n1

n2n3

n4

n5

n6

n7

n8

n9

n10

n11

Private node

Public node

shuffle request

Page 68: Gossip

Epidemic Algorithms – Amir H. Payberah 68April 10,  2012

Solutions for Communicating with Private Nodes (1/2)

● Relay communications to the private node using a public relay node.

Page 69: Gossip

Epidemic Algorithms – Amir H. Payberah 69April 10,  2012

Solutions for Communicating with Private Nodes (2/2)

● Use a NAT hole­punching algorithm to establish a direct connection to the private node using a public rendezvous node.

Page 70: Gossip

  Epidemic Algorithms – Amir H. Payberah 70April 10,  2012

Relaying or Hole Punching?

● Relaying?

Lower latency message exchange.

• Enables lower gossip cycle periods. 

• Necessary in dynamic networks

● Hole punching?

Decreases load on public nodes.

• But not if shuffle messages are small.

Page 71: Gossip

  Epidemic Algorithms – Amir H. Payberah 71April 10,  2012

Gozar as a NAT­aware Peer Sampling Example

● In Gozar, each private node connects to one or more public nodes, called partners that act as a relay or rendezvous server on behalf of the private node.

● A node's descriptor consists of both its own address, its NAT type, and its partners' addresses at the time of descriptor creation.

● When a node wants to gossip with a private node, it uses the partner addresses in its descriptor to communicate with the private node.

Page 72: Gossip

Epidemic Algorithms – Amir H. Payberah 72April 10,  2012

Partnering (1/10)

Bootstrap servern1n1

n2

n3

n4

n5

...

...

...

...

Page 73: Gossip

Epidemic Algorithms – Amir H. Payberah 73April 10,  2012

Partnering (2/10)

Bootstrap servern1n1

n2

n3

n4

n5

...

...

...

...

Page 74: Gossip

Epidemic Algorithms – Amir H. Payberah 74April 10,  2012

Partnering (3/10)

Bootstrap servern1n1

n2

n3

n4

n5n1, public, nulln4, public, null...

...

...

...

...

Page 75: Gossip

Epidemic Algorithms – Amir H. Payberah 75April 10,  2012

Partnering (4/10)

Bootstrap servern1n1

n2

n3

n4

n5n1, public, nulln4, public, null...

request

request

...

...

...

...

Page 76: Gossip

Epidemic Algorithms – Amir H. Payberah 76April 10,  2012

Partnering (5/10)

Bootstrap servern1n1

n2

n3

n4

n5n1, public, nulln4, public, null...

ACK

NACK

...

...

...

...

Page 77: Gossip

Epidemic Algorithms – Amir H. Payberah 77April 10,  2012

Partnering (6/10)

Bootstrap servern1n1

n2

n3

n4

n5n1, public, nulln4, public, null...

...

...

...

...

Page 78: Gossip

Epidemic Algorithms – Amir H. Payberah 78April 10,  2012

Partnering (7/10)

Bootstrap servern1n1

n2

n3

n4

n5n1, public, nulln4, public, null...

Shuffle exchange

n2, private, n1...

...

...

...

Page 79: Gossip

Epidemic Algorithms – Amir H. Payberah 79April 10,  2012

Partnering (8/10)

Bootstrap servern1n1

n2

n3

n4

n5n1, public, nulln4, public, null...

Shuffle exchange

n2, private, n1...

n2, private, n1...

...

...

Page 80: Gossip

Epidemic Algorithms – Amir H. Payberah 80April 10,  2012

Partnering (9/10)

Bootstrap servern1n1

n2

n3

n4

n5n1, public, nulln4, public, null...

Shuffle request

n2, private, n1...

n2, private, n1...

...

...

Page 81: Gossip

Epidemic Algorithms – Amir H. Payberah 81April 10,  2012

Partnering (10/10)

Bootstrap servern1n1

n2

n3

n4

n5n1, public, nulln4, public, null...

Shuffle response

n2, private, n1...

n2, private, n1...

...

...

Page 82: Gossip

Epidemic Algorithms – Amir H. PayberahApril 10,  2012 82

Summary

Page 83: Gossip

  Epidemic Algorithms – Amir H. Payberah 83April 10,  2012

Summary

● Epidemics algorithms are important technique to solve problems in dynamic large scale systems

Scalable

Simple

Robust to node failures, message loss and transient network disruptions (network partitions … )

● Applications:

Aggregation

Membership management

Topology management

Page 84: Gossip

Epidemic Algorithms – Amir H. PayberahApril 10,  2012 84

Question

AcknowledgementSome slides were derived from the slides of Alberto Montresor and Seif Haridi