the chord p2p network
DESCRIPTION
The Chord P2P Network. Some slides have been borrowed from the original presentation by the authors. Chord vs.Tapestry. The topology of the Chord network, as defined by the successor pointers, must satisfy a well-defined structure . - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: The Chord P2P Network](https://reader035.vdocuments.us/reader035/viewer/2022070419/56815bbe550346895dc9bd7b/html5/thumbnails/1.jpg)
The Chord P2P Network
Some slides have been borrowed from the original presentation by the authors
![Page 2: The Chord P2P Network](https://reader035.vdocuments.us/reader035/viewer/2022070419/56815bbe550346895dc9bd7b/html5/thumbnails/2.jpg)
Chord vs.Tapestry
• The topology of the Chord network, as defined by the successor pointers, must satisfy a well-defined structure.
• Tapestry (uses Plaxton routing) requires the root of the object to be placed in a designated node, but the object can be placed locally. In contrast, Chord requires the object to be placed at a designated node.
![Page 3: The Chord P2P Network](https://reader035.vdocuments.us/reader035/viewer/2022070419/56815bbe550346895dc9bd7b/html5/thumbnails/3.jpg)
Main features of Chord
Load balancing via Consistent Hashing
• Small routing tables: log n
• Small routing delay: log n hops
• Fast join/leave protocol (polylog time)
![Page 4: The Chord P2P Network](https://reader035.vdocuments.us/reader035/viewer/2022070419/56815bbe550346895dc9bd7b/html5/thumbnails/4.jpg)
Consistent Hashing
Assigns both nodes and objects from an m-bit key.
Order these nodes around an identifier circle (what does a circle mean here?) according to the order of their keys (0 .. 2m-1). This ring is known as the Chord Ring.
Object with key k is assigned to the first node whosekey is ≥ k (called the successor node of key k)
![Page 5: The Chord P2P Network](https://reader035.vdocuments.us/reader035/viewer/2022070419/56815bbe550346895dc9bd7b/html5/thumbnails/5.jpg)
Consistent Hashing
N32
N90
N105
D80
D20
D120
Example: Node 90 is the “successor” of document 80.
(0)
N=128Circular 7-bit
ID space
![Page 6: The Chord P2P Network](https://reader035.vdocuments.us/reader035/viewer/2022070419/56815bbe550346895dc9bd7b/html5/thumbnails/6.jpg)
Consistent Hashing [Karger 97]
Property 1If there are N nodes and K keys, then with high probability,each node is responsible for (1+epsilon )K/N keys.
Property 2When a node joins or leaves the network, the responsibilityof at most O(K/N) keys changes hand (only to or from the nodethat is joining or leaving.
When K is large, the impact on individual nodes is quite small.
![Page 7: The Chord P2P Network](https://reader035.vdocuments.us/reader035/viewer/2022070419/56815bbe550346895dc9bd7b/html5/thumbnails/7.jpg)
Consistent hashing
N32
N90
N105
K80
K20
K5
Circular 7-bitID space
Object with Key 5Node 105
An object with key k is stored at its successor (node with key ≥ k)
![Page 8: The Chord P2P Network](https://reader035.vdocuments.us/reader035/viewer/2022070419/56815bbe550346895dc9bd7b/html5/thumbnails/8.jpg)
The log N Fingers
(0)
Each node knows of only log N other nodes.
N80
1/8
1/161/321/641/128
Circular (log N)-bitID space
Distance of N80’sneighbors from
N80
1/4 1/2
![Page 9: The Chord P2P Network](https://reader035.vdocuments.us/reader035/viewer/2022070419/56815bbe550346895dc9bd7b/html5/thumbnails/9.jpg)
Finger i points to successor of n+2i
N80
½¼
1/8
1/161/321/641/128
112N120
![Page 10: The Chord P2P Network](https://reader035.vdocuments.us/reader035/viewer/2022070419/56815bbe550346895dc9bd7b/html5/thumbnails/10.jpg)
Chord Finger Table
(0)
N32
N60
N79
N70
N113
N102
N40
N52
33..33 N4034..35 N4036..39 N4040..47 N4048..63 N5264..95 N7096..31 N102
Node n’s i-th entry: first node ≥ n + 2i-1
N32’sFinger Table
N80
N85N=128
Finger table actually contains ID and IP address
![Page 11: The Chord P2P Network](https://reader035.vdocuments.us/reader035/viewer/2022070419/56815bbe550346895dc9bd7b/html5/thumbnails/11.jpg)
Lookup
33..33 N4034..35 N4036..39 N4040..47 N4048..63 N5264..95 N7096..31 N102
N32’sFinger Table
Node 32, lookup(82): 32 70 80 85.
71..71 N7972..73 N7974..77 N7978..85 N8086..101 N102102..5 N1026..69 N32
N70’sFinger Table
(0)
N32
N60N79
N70
N113
N102
N40
N52
N80
N85 81..81 N8582..83 N8584..87 N8588..95 N10296..111 N102112..15 N11316..79 N32
N80’sFinger Table
Greedy routing
![Page 12: The Chord P2P Network](https://reader035.vdocuments.us/reader035/viewer/2022070419/56815bbe550346895dc9bd7b/html5/thumbnails/12.jpg)
New Node Joins
(0)
N32
N60
N80
N70
N113
N102
N40
N52
1 21..212 22..233 24..274 28..355 36..516 52..837 84..19
N20’sFinger Table
N20
Assume N20 knows one of the existing nodes.
![Page 13: The Chord P2P Network](https://reader035.vdocuments.us/reader035/viewer/2022070419/56815bbe550346895dc9bd7b/html5/thumbnails/13.jpg)
New Node Joinsw (2)
(0)
N32
N60
N80
N70
N113
N102
N40
N52
21..21 N3222..23 N3224..27 N3228..35 N3236..51 N4052..83 N5284..19 N102
N20’sFinger Table
N20
Node 20 asks that node for successor to 21, 22, …, 52, 84.
![Page 14: The Chord P2P Network](https://reader035.vdocuments.us/reader035/viewer/2022070419/56815bbe550346895dc9bd7b/html5/thumbnails/14.jpg)
The Join procedure
The new node id asks a gateway node n
to find the successor of id
n.(find_successor(id)
if id = (n, successor]
then return successor
else forward the query around the circle
fi
Needs O(n) messages. This is slow.
![Page 15: The Chord P2P Network](https://reader035.vdocuments.us/reader035/viewer/2022070419/56815bbe550346895dc9bd7b/html5/thumbnails/15.jpg)
Steps in join
id
n
Successor(n)
id
n
Finally
But the transition does not happen immediately
Linked list insert
![Page 16: The Chord P2P Network](https://reader035.vdocuments.us/reader035/viewer/2022070419/56815bbe550346895dc9bd7b/html5/thumbnails/16.jpg)
A More Efficient Join// ask n to find the successor of idif id = (n, successor]
then return successorelse n’= closest_ preceding_node (id)
return n’.find_successor(id)fi// search for the highest predecessor of id
n. closest_preceding_node(id)for i = log N downto 1if (finger[i] is between (n,id)return finger[i]
![Page 17: The Chord P2P Network](https://reader035.vdocuments.us/reader035/viewer/2022070419/56815bbe550346895dc9bd7b/html5/thumbnails/17.jpg)
Example
(0)
N32
N60
N80
N70
N113
N102
N40
N52
N20
K65
N20 wants tofind out thesuccessor of key 65
![Page 18: The Chord P2P Network](https://reader035.vdocuments.us/reader035/viewer/2022070419/56815bbe550346895dc9bd7b/html5/thumbnails/18.jpg)
After join move objects(0)
N32
N60
N80
N70
N113
N102
N40
N52
21..21 N3222..23 N3224..27 N3228..35 N3236..51 N4052..83 N5284..19 N102
N20’sFinger Table
N20
Node 20 moves documents from node 32.
D114..20
Notify nodes that must includeN20 in their table. N113[1]=N20, not N32.
![Page 19: The Chord P2P Network](https://reader035.vdocuments.us/reader035/viewer/2022070419/56815bbe550346895dc9bd7b/html5/thumbnails/19.jpg)
Three steps in join
Step 1. Initialize predecessor and fingers of the new node.
Step 2. Update the predecessor and the fingers of the
existing nodes. (Thus notify nodes that must include N20 in their table. N113[1] = N20, not N32.
Step 3. Transfer objects to the new node as appropriate.
(Knowledge of predecessor is useful in stabilization)
![Page 20: The Chord P2P Network](https://reader035.vdocuments.us/reader035/viewer/2022070419/56815bbe550346895dc9bd7b/html5/thumbnails/20.jpg)
Concurrent Join
New node n
n1
n2
[Before]
New node n
n2
n1
[After]
New node n’ New node n’
![Page 21: The Chord P2P Network](https://reader035.vdocuments.us/reader035/viewer/2022070419/56815bbe550346895dc9bd7b/html5/thumbnails/21.jpg)
Stabilization
New node n
n2
n1
Predecessor.successor(n1) ≠ n1, so n1 adoptspredecessor.successor(n1) = n as its new successor
New node n
n2
Periodic stabilization is needed to integrate the newnode into the network and restore the invariant.
n1
![Page 22: The Chord P2P Network](https://reader035.vdocuments.us/reader035/viewer/2022070419/56815bbe550346895dc9bd7b/html5/thumbnails/22.jpg)
The complexity of join
With high probability, any node joining or leaving
an N-node Chord network will use O(log 2N) messages
to re-establish the Chord routing invariants and finger
tables.
![Page 23: The Chord P2P Network](https://reader035.vdocuments.us/reader035/viewer/2022070419/56815bbe550346895dc9bd7b/html5/thumbnails/23.jpg)
Chord Summary
• Log(n) lookup messages and table space.• Well-defined location for each ID.
• No search required.• Natural load balance.• No name structure imposed.• Minimal join/leave disruption.