Upload
tran-thinh
View
216
Download
0
Embed Size (px)
Citation preview
8/12/2019 09 P2P Pastry
1/30
Peer-to-Peer Architectures
Programmazione Avanzata di Rete
a.a. 2003/04
Mauceri Calogero
8/12/2019 09 P2P Pastry
2/30
16 May 2007 Mauceri Calogero P2P Architectures 2 / 29
Outline Peer to peer architecture
DHT
Pastry
Scribe
8/12/2019 09 P2P Pastry
3/30
16 May 2007 Mauceri Calogero P2P Architectures 3 / 29
Publish/Subscribe SystemsI want to receive msg with topic X
?P
S
S
S
8/12/2019 09 P2P Pastry
4/30
16 May 2007 Mauceri Calogero P2P Architectures 4 / 29
Client-Server Architecture
ServerP1
P2
S1
S2
S3
Simple
A lot of traffic and computation in the server No scalable
Single point of failure
8/12/2019 09 P2P Pastry
5/30
16 May 2007 Mauceri Calogero P2P Architectures 5 / 29
Peer-to-peer Architecture
Distributed system architecture:
No centralized control
Nodes are symmetric in function
Large number of heterogeneous and unreliable
nodes
8/12/2019 09 P2P Pastry
6/30
16 May 2007 Mauceri Calogero P2P Architectures 6 / 29
Lookup Problem
P
?
Store msgs with topic X
I want to receive msgs with topic X
S
R
8/12/2019 09 P2P Pastry
7/30
16 May 2007 Mauceri Calogero P2P Architectures 7 / 29
Centralized Approach
P
S
Single Point of failure
O(N) status in the coordinator node
R
C
8/12/2019 09 P2P Pastry
8/30
16 May 2007 Mauceri Calogero P2P Architectures 8 / 29
Flooding Approach
P
S
R
O(N) messages per lookup
8/12/2019 09 P2P Pastry
9/30
8/12/2019 09 P2P Pastry
10/30
16 May 2007 Mauceri Calogero P2P Architectures 10 / 29
Distributed Hash Table
Requirements
Scalability
Adaptivity
Reliability
Efficiency Decentralized
Load Balance
8/12/2019 09 P2P Pastry
11/30
16 May 2007 Mauceri Calogero P2P Architectures 11 / 29
Distributed Hash Table Approach
P
S
R
Usually O(log(N)) messages per lookup
Building and maintenance of routing tables is needed
8/12/2019 09 P2P Pastry
12/30
Pastry
A peer-to-peer protocol example
8/12/2019 09 P2P Pastry
13/30
16 May 2007 Mauceri Calogero P2P Architectures 13 / 29
Pastry Design Node IDs and keys are 128bit numbers
with base 2b. Each node has a unique nodeID assigned
randomly when node joins the system.
Key are stored in the node with nodeID
numerically closest to the key.
Prefix routing scheme (numerically closest). Expected routing steps is O(log N).
8/12/2019 09 P2P Pastry
14/30
16 May 2007 Mauceri Calogero P2P Architectures 14 / 29
Pastry Routing TableNodes numerically closerto the present Node
Nodes physically closestto the present node
Prefix-based routing entries:
common prefix with10233102-next digit-rest ofNodeId
nodeId=10233102, b =2, l = 8
8/12/2019 09 P2P Pastry
15/30
16 May 2007 Mauceri Calogero P2P Architectures 15 / 29
Routing Check the leaf set
If destination present route to it directly Consult the routing table
Forward to a node whose identifier matches themessage key in at least one more digit
Forward to a node whose identifier is numericallycloser to the message key
This routing procedure converge
8/12/2019 09 P2P Pastry
16/30
16 May 2007 Mauceri Calogero P2P Architectures 16 / 29
Routing Example
65a1fc d13da3
d4213f
d462ba
d467ca
d471f1
Route(d46a1c)
8/12/2019 09 P2P Pastry
17/30
8/12/2019 09 P2P Pastry
18/30
16 May 2007 Mauceri Calogero P2P Architectures 18 / 29
Node Arrival Example
65a1fc d13da3
d4213f
d462ba
d467ca
Route(d46a1c)
d46a1cI want to join to Pastry network
8/12/2019 09 P2P Pastry
19/30
8/12/2019 09 P2P Pastry
20/30
16 May 2007 Mauceri Calogero P2P Architectures 20 / 29
Locality (1/2) when X joins the Pastry network, it send a join
message to A and finally the message will reachZ Because A is supposed to be physically near to X, the
entries in the 1st row of A are near to A, and thus nearto X (triangular inequality)
The nodes in the 2nd row of Bs routing table are nearto B, but much farther than X to B
These nodes are likely to be near to X, although notexactly the nearest
To compensate for the cascading error, X asks thenodes in its neighborhood set and routing table fortheir states, and find the entries nearest to X
8/12/2019 09 P2P Pastry
21/30
16 May 2007 Mauceri Calogero P2P Architectures 21 / 29
Locality (2/2)
XA
B
C
Z
Level 0
Level 1
Level 2
8/12/2019 09 P2P Pastry
22/30
16 May 2007 Mauceri Calogero P2P Architectures 22 / 29
Locating the nearest among k
nodes Goal:
among the k numerically closest nodes to a key, amessage tends to first reach a node near the client.
Problem: Since Pastry routes primarily based on nodeId
prefixes, it may miss nearby nodes with a differentprefix than the key.
Solution (using a heuristic): Based on estimating the density of nodeIds, it detects
when a message approaches the set of k and thenswitches to numerically nearest address basedrouting to locate the nearest replica.
8/12/2019 09 P2P Pastry
23/30
8/12/2019 09 P2P Pastry
24/30
16 May 2007 Mauceri Calogero P2P Architectures 24 / 29
Scribe Topic-based publish-subscribe system
Peer-to-peer network of Pastry nodes
Application-level multicast
Best-effort dissemination of events
8/12/2019 09 P2P Pastry
25/30
16 May 2007 Mauceri Calogero P2P Architectures 25 / 29
Scribe Architecture Each topic has a unique topicId.
Rendezvous point The Scribe node with a nodeId numerically
closet to the topicId
Root of multicast tree.
8/12/2019 09 P2P Pastry
26/30
16 May 2007 Mauceri Calogero P2P Architectures 26 / 29
Create Topic
Rendez-vous point
nodeId = topicId
Route(CREATE,topicId)
8/12/2019 09 P2P Pastry
27/30
16 May 2007 Mauceri Calogero P2P Architectures 27 / 29
Subscription
Route(JOIN,topicId = 1100)
01111000
1001
1011
1100
11011111
0100 0111
1001
0100
1101
1100
1011
8/12/2019 09 P2P Pastry
28/30
16 May 2007 Mauceri Calogero P2P Architectures 28 / 29
Event Dissemination
Route through the
Pastry network using
the topicId as the
destination Dissemination along
the multicast tree
starting from the root 0111
1001
0100
1101
1100
1011
8/12/2019 09 P2P Pastry
29/30
16 May 2007 Mauceri Calogero P2P Architectures 29 / 29
Repairing the multicast tree
0111
1001
0100
1101
1100
1111
8/12/2019 09 P2P Pastry
30/30
16 May 2007 Mauceri Calogero P2P Architectures 30 / 29
References Distributed Hash Tables (DHTs): Design and Performance. Brad Karp. (ppt file)
A Survey on Distributed Hash Tables. Nitin Gupta. (html page)
Pastry: Scalable, distributed object location and routing for large-scale peer-to-
peer systems. Antony Rowstron and Peter Druschel. (pdf file)
Scribe: A large-scale and decentralized application-level multicastinfrastructure. Miguel Castro, Peter Druschel, Anne-Marie Kermarrec, and Antony
Rowstron. (pdf file)