Title: Chord: A Scalable Peer-to-peer Lookup Protocol for Internet Applications
1Chord A Scalable Peer-to-peer Lookup
Protocolfor Internet Applications
- Xiaozhou Li
- COS 461 Computer Networks (precept 04/06/12)
- Princeton University
2Background
- We studied P2P file sharing in class
- Napster
- Gnutella
- KaZaA
- BitTorrent
- Today, lets learn more!
- Chord a scalable P2P lookup protocol
- CFS a distributed file system built on top of
Chord - http//pdos.csail.mit.edu/chord
3Review distributed hash table
Distributed application
put(key, data)
get (key)
data
Distributed hash table
- DHT provides the information look up service for
P2P applications. - Nodes uniformly distributed across key space
- Nodes form an overlay network
- Nodes maintain list of neighbors in routing
table - Decoupled from physical network topology
4The lookup problem
N2
N3
N1
Internet
Key beat it Value MP3 data
?
Client
Publisher
N6
N4
Lookup(beat it)
N5
5Centralized lookup (Napster)
N2
N1
SetLoc(beat it, N4)
N3
Client
DB
Publisher_at_
N4
Lookup(beat it)
Key beat it Value MP3 data
N8
N9
N7
N6
Simple, but O(N) state and a single point of
failure
6Flooded queries (Gnutella)
N2
N1
Lookup(beat it)
N3
Client
N4
Publisher_at_
Key beat it Value MP3 data
N6
N8
N7
N9
Robust, but worst case O(N) messages per lookup
7Routed queries (Chord)
N2
N1
N3
Client
N4
Publisher
Lookup(beat it)
N7
Key beat it Value MP3 data
N6
N8
N9
8Routing challenges
- Define a useful key nearness metric
- Keep the hop count small
- Keep the tables small
- Stay robust despite rapid change
- Chord emphasizes efficiency and simplicity
9Chord properties
- Efficient O(log(N)) messages per lookup
- N is the total number of servers
- Scalable O(log(N)) state per node
- Robust survives massive failures
- Proofs are in paper / tech report
- Assuming no malicious participants
10Chord overview
- Provides peer-to-peer hash lookup
- Lookup(key) ? return IP address
- Chord does not store the data
- How does Chord route lookups?
- How does Chord maintain routing tables?
11Chord IDs
- Key identifier SHA-1(key)
- Node identifier SHA-1(IP address)
- Both are uniformly distributed
- Both exist in the same ID space
- How to map key IDs to node IDs?
- The heart of Chord protocol is consistent
hashing
12Review consistent hashing for data partitioning
and replication
replication factor N3
hash(key2)
A key is stored at its successor node with next
higher ID
12
13Identifier to node mapping example
- Node 8 maps 5,8
- Node 15 maps 9,15
- Node 20 maps 16, 20
-
- Node 4 maps 59, 4
- Each node maintains a pointer to its successor
4
58
8
15
44
20
35
32
14Lookup
lookup(37)
4
- Each node maintains its successor
- Route packet (ID, data) to the node responsible
for ID using successor pointers
58
8
node44
15
44
20
35
32
15Join Operation
- Node with id50 joins the ring via node 15
- Node 50 send join(50) to node 15
- Node 44 returns node 58
- Node 50 updates its successor to 58
succ4
pred44
4
58
8
succ58
succnil
prednil
15
50
44
20
succ58
pred35
35
32
15
16Periodic Stabilize
succ4
- Node 50 periodic stabilize
- Sends stabilize message to 58
- Node 50 send notify message to 58
- Update pred44
pred44
pred50
4
58
stabilize(node50) notify(node50)
8
succ.pred44
succ58
prednil
15
50
44
20
succ58
pred35
35
32
17Periodic Stabilize
succ4
pred50
- Node 44 periodic stabilize
- Asks 58 for pred (50)
- Node 44 updates its successor to 50
4
58
8
succ58
prednil
15
50
44
20
succ50
succ58
pred35
35
32
18Periodic Stabilize
succ4
pred50
- Node 44 has a new successor (50)
- Node 44 sends a notify message to node 50
4
58
8
succ58
pred44
prednil
15
50
44
20
succ50
pred35
35
32
19Periodic Stabilize Converges!
pred50
- This completes the joining operation!
4
58
8
succ58
50
pred44
15
44
20
succ50
35
32
20Achieving Efficiency finger tables
Say m7
Finger Table at 80
0
i fti 0 96 1 96 2 96 3 96 4 96 5 112 6
20
(80 26) mod 27 16
112
80 25
20
96
80 24
32
80 23
80 22
80 21
45
80 20
80
ith entry at peer with id n is first peer with id
gt
- Each node only stores O(log N) entries
- Each look up takes at most O(log N) hops
21Achieving Robustness
- What if nodes FAIL?
- Ring robustness each node maintains the k (gt 1)
immediate successors instead of only one
successor - If smallest successor does no respond, substitute
the second entry in its successor list - Unlikely all successors fail simultaneously
- Modifications to stabilize protocol (see paper!)
22Example of Chord-based storage system
Storage App
Storage App
Storage App
Distributed Hashtable
Distributed Hashtable
Distributed Hashtable
Chord
Chord
Chord
Client
Server
Server
23Cooperative File System (CFS)
Block storage Availability / replication Authentic
ation Caching Consistency Server
selection Keyword search Lookup
DHash distributed block store
Chord
- Powerful lookup simplifies other mechanisms
24Cooperative File System (cont.)
- Block storage
- Split each file into blocks and distribute those
blocks over many servers - Balance the load of serving popular files
- Data replication
- Replicate each block on k servers
- Increase availability
- Reduce latency (fetch from the server with least
latency)
25Cooperative File System (cont.)
- Caching
- Caches blocks along the lookup path
- Avoid overloading servers that hold popular data
- Load balance
- Different servers may have different capacities
- A real server may act as multiple virtual
servers, by being hashed to several different IDs.
26Q A