Upload
efrem
View
57
Download
0
Embed Size (px)
DESCRIPTION
Chord: A Scalable Peer-to-Peer Lookup Service for Internet Applications. Ion StoicaRobert Morris David Liben-NowellDavid R. Hari Balakrishnan Karger M. Frans KaashoekFrank Dabek. 1097304151 莊宜豐. Outline. - PowerPoint PPT Presentation
Citation preview
Chord: A Scalable Peer-to-Peer Lookup Service for Internet
Applications
Ion Stoica Robert MorrisDavid Liben-Nowell David R. Hari Balakrishnan KargerM. Frans Kaashoek Frank Dabek
1097304151 莊宜豐
IntroductionChord ProtocolHashing Finger Table
Lookup Simple Scalable
Conclusion
Outline
Introduction
Slide 3
Client / server architecture Peer-to-Peer
Chord Protocol : System Model
• Load balance:– Chord acts as a distributed hash function, spreading keys evenly over the nodes.
• Decentralization:– Chord is fully distributed: no node is more important than any
other.• Scalability:
– The cost of a Chord lookup grows as the log of the number of nodes, so even very large systems are feasible.
• Availability:– Chord automatically adjusts its internal tables to reflect newly
joined nodes as well as node failures, ensuring that, the node responsible for a key can always be found.
• Flexible naming:– Chord places no constraints on the structure of the keys it looks
up.
Chord: Distributed Hash Table• Chord provides support for just
one operation: given a key, it maps the key onto a node.
• Hashing function assigns each node and key an m-bit identifier using SHA-1 base hash function.
• Node’s IP address is hashed.
• Each node has a m-bits node ID ( 0~2m-1)
• Keys, too, are m-bit identifiers
m= 6
k10
CircularID Space
N1
N8
N14
N21
N32N38
N42
N48
N51
N56
k24
k30k38
k54
An ID Ring of length 2m-1
Chord: Distributed Hash Table
• Each node, n, maintains a routing table with (at most) m entries, called the finger table.
Finger Table
Finger Table
Successor()
Bit=6
i=1i=2i=3i=4i=5i=6
start.node()
start.node ()
Successor()
When Node=8,i=3start.node(n+2i-1=N12)
start.node()
i=3
When Node=8,i=4start.node(n+2i-1=N16)
i=4
Node=8,i=3
start.node(N12)<= next.node (N14)
Successor(N12)=next.node (N14) =N14
When Node=8,i=3start.node(n+2i-1=N12)
next.node(N14)
i=3
Successor ()
Key/node space partitions
N8
N16
N14
i = 3i = 4
N14N14 N21
N12
start.node()
start.node()
Successor() Successor()
i = 2i = 1 N21
Simple Lookup
CircularID Space
N1
N8
N14
N21
N32N38
N42
N48
N51
N56k54
lookup(k54)
Scalable Lookup
k10
N1
N8
N14
N21
N32N38
N42
N48
N51
N56
k24
k30k38
k54
Finger tableN8+1 N14N8+2 N14N8+4 N14N8+8 N21N8+16 N32N8+32 N42+1
+2+4+8+16
+32
Chord : Scalable Lookup
Find (K54)
N1
N8
N14
N21
N32N38
N42
N48
N51
N56k54
Finger table at N8N8+1 N14N8+2 N14N8+4 N14N8+8 N21N8+16 N32N8+32 N42
+1
+2+4+8+16
+32
lookup(k54)
Lookup(K54) :N8// ask node n to find the successor of idn.find_successor(id)
if (id belongs to (n, successor]) // k54 belongs to (N8.N14)return successor;
elsen0 = closest preceding node(id);return n0.find_successor(id);
// search the local table for the highest predecessor of idn.closest_preceding_node(id)
for i = m downto 1 // i =6if (finger[i] belongs to (n, id)) // finger[6] =42 belongs to (N8.K54)
return finger[i];return n;
Chord : Scalable Lookup
Find (K54)
N1
N8
N14
N21
N32N38
N42
N48
N51
N56k54
Finger table at N42N42+1 N48N42+2 N48N42+4 N48N42+8 N51N42+16 N1N42+32 N14
lookup(k54)
Lookup(K54) :N42// ask node n to find the successor of idn.find_successor(id)
if (id belongs to (n, successor]) // k54 belongs to (N42.N48)return successor;
elsen0 = closest preceding node(id);return n0.find_successor(id);
// search the local table for the highest predecessor of idn.closest_preceding_node(id)
for i = m downto 1 // i =4if (finger[i] belongs to (n, id)) // finger[4] =51 belongs to (N42.K54)
return finger[i];return n;
Chord : Scalable Lookup
Find (K54)
N1
N8
N14
N21
N32N38
N42
N48
N51
N56k54
Finger table at N51N51+1 N56N51+2 N56N51+4 N56N51+8 N1N51+16 N8N51+32 N21
lookup(k54)
Lookup(K54) :N51// ask node n to find the successor of idn.find_successor(id)
if (id belongs to (n, successor]) // k54 belongs to (N51.N56)return successor; // return N56
elsen0 = closest preceding node(id);return n0.find_successor(id);
// search the local table for the highest predecessor of idn.closest_preceding_node(id)
for i = m downto 1 if (finger[i] belongs to (n, id))
return finger[i];return n;
• IP Hash NoID• Data Hash DataID • Search Data Hash Key• DataID Hash Key• Search Data ( Key ) NoID DataID(Key) DataIP
• A’s NoID=212• 如果 A有檔案”寶貝 .mp3”經過 hashing =88555• B’s NoID=234• 如果 B有檔案”屋頂 .mp3”經過 hashing = 45651• C’s NoID=555• 如果 A有檔案”麵包 .mp3”經過 hashing =14212• D’s NoID=651• 如果 A有檔案”籃子 .mp3”經過 hashing = 66234
• 當搜尋者輸入欲搜尋的檔案,經過 hash除以 1000產生餘數,• 而餘數就是 KEY值• 假設 A要搜尋籃子這首歌,經過 hash得到 KEY值 234,所以尋找 K234• 而 KEY234是歸 B管,所以當 A路由到 B的時候, B會跟 A說,檔案在 D那
• 所以 A就跑過去 D那詢問,給不給下
Conclusion
• Chord protocol solves it in a efficient decentralized manner– Routing information: O(log N) nodes– Lookup: O(log N) nodes– Update: O(log2 N) messages
THX