Download presentation
Presentation is loading. Please wait.
Published byEileen Claycomb Modified over 9 years ago
1
Technische Universität Chemnitz Kurt Tutschku Vertretung - Professur Rechner- netze und verteilte Systeme Chord - A Distributed Hash Table Yimei Liao
2
Hauptseminar „Peer-to-Peer Networks“ Technische Universität Yimei Liao Chemnitz 2 Outline Lookup problem in Peer-to-Peer systems and Solutions Chord Algorithm –Consistent Hashing –Scalable Key Location –Node joins –Stabilization Summary
3
Hauptseminar „Peer-to-Peer Networks“ Technische Universität Yimei Liao Chemnitz 3 Peer-to-Peer Systems Peer-to-Peer System: self-organizing system of equal, autononous entities (peers) decentralized resource usage decentraliced self-organization where to store? where to get? Solutions centralized servers flooding search distributed Hash Tables
4
Hauptseminar „Peer-to-Peer Networks“ Technische Universität Yimei Liao Chemnitz 4 Solutions to lookup problem centralized servers –Maintain the current location of data items in a central server –Search complexity O(1) –Central server becomes crucial –Best for simple and small applications flooding search –Broadcast a request for an item among the nodes –No additional routing informations –High bandwidth consumption –Search complexity O(N 2 ) –Results are not guaranteed
5
Hauptseminar „Peer-to-Peer Networks“ Technische Universität Yimei Liao Chemnitz 5 Solutions to lookup problem distributed hash tables –A global view of data distributed among many nodes. –Mapping nodes and data items into a common address space –Each DHT node manages a small number of references to other nodes –Queries are routed via a small number of nodes to the target node –Load for retrieving items should be balanced equally among all nodes –Robust against random failure and attacks –Provides a definitive answer about results
6
Hauptseminar „Peer-to-Peer Networks“ Technische Universität Yimei Liao Chemnitz 6 Chord Algorithm – Consistent Hashing supports just one operation: given a key, it maps the key onto a node. Consistent Hashing –Assign each node and key an m-bit identifier using a base hash function such as SHA-1 –Identifiers are ordered in an identifier circle modulo 2 m (Chord ring) –Key k is assigned to the first node whose identifier is equal to or follows k.
7
Hauptseminar „Peer-to-Peer Networks“ Technische Universität Yimei Liao Chemnitz 7 Chord Algorithm – Consistent Hashing identifier space : m=3 node key 0 1 3 1 2 6 6 1 2 0 4 26 5 1 3 7 identifier circle
8
Hauptseminar „Peer-to-Peer Networks“ Technische Universität Yimei Liao Chemnitz 8 Chord Algorithm – Simple Key Lookup Simple Key Lookup 1 2 6 0 4 26 5 1 3 7 Queries are passed around the circle via successor pointers Requires traversing all Nodes to find the appropriate mapping successor(1) = 3 successor(3) = 6 successor(6) = 0 successor(0) = 1 Node 0 sends a query for key 6
9
Hauptseminar „Peer-to-Peer Networks“ Technische Universität Yimei Liao Chemnitz 9 Chord Algorithm – Scalable Key Location Finger Table –Each node n maintains a routing table with up to m entries –The i th entry in the table at node n contains the identifier of the first node s that succeeds n by at least 2 i-1 on the identifier circle.(s = successor(n+2 i-1 )). –s is called the i th finger of node n. Definition of variables for node n
10
Hauptseminar „Peer-to-Peer Networks“ Technische Universität Yimei Liao Chemnitz 10 Chord Algorithm – Scalable Key Location Finger table m = 3, each node n maintains at most 3 entries 0 4 26 5 1 3 7 finger table keys For.startInt.Succ. 0+2 0 0+2 1 0+2 2 124124 [1,2)3 3 6 [2,4) [4,0) finger table keys For.startInt.Succ. 3+2 0 3+2 1 3+2 2 457457 [4,5)6 6 0 [5,7) [7,3) 1 2 finger table keys For.startInt.Succ. 6+2 0 6+2 1 6+2 2 702702 [7,0)0 0 3 [0,2) [2,6) 5
11
Hauptseminar „Peer-to-Peer Networks“ Technische Universität Yimei Liao Chemnitz 11 Chord Algorithm – Scalable Key Location Pseudocode to find the successor node of an identifier Walk clockwise to find the node which precedes id and whose successor succeeds id Start with the m th finger of node n See if it comes between node n and the id, if not, check the m-1 th finger until we find one wich does. This is the closest node preceding id among all the fingers of n Find id’s successor by finding the immediate predecessor of the id
12
Hauptseminar „Peer-to-Peer Networks“ Technische Universität Yimei Liao Chemnitz 12 Chord Algorithm – Scalable Key Location id=5 n=7 0 4 26 5 1 3 7 finger table keys startInt.Succ. 1 [1,2) 3 2 [2,4) 3 4 [4,0) 4 finger table keys startInt.Succ. 4[4,5) 5[5,7) 7[7,3) 1 2 finger table keys startInt.Succ. 0[0,1)0 1[1,3)0 3[3,7) 6 4 Successor 0 Predecessor 4 3 Successor 3 Predecessor 7 Successor Predecessor 0 finger table keys startInt.Succ. 5[5,6)7 6[6,0)7 0[0,4)0 Successor Predecessor 3 7 4 7 7 successor(5) = 7 4 O(logN)
13
Hauptseminar „Peer-to-Peer Networks“ Technische Universität Yimei Liao Chemnitz 13 Chord Algorithm - Node joins Invariants to be preserve Each node’s successor is correctly maintained For every key k, node successor(k) is responsible for k It is desirable for the finger tables to be correct Tasks to be performed by Chord Initialize the predecessor and fingers of node n Update the fingers and predecessor of existing nodes to reflect the addition of n Notify the higher layer software so that it can transfer state associated with keys that node n is now responsible for
14
Hauptseminar „Peer-to-Peer Networks“ Technische Universität Yimei Liao Chemnitz 14 Chord Algorithm - Node joins 0 4 26 5 1 3 7 finger table keys startInt.Succ. 1 [1,2) 3 2 [2,4) 3 4 [4,0) 7 finger table keys startInt.Succ. 4[4,5)7 5[5,7)7 7[7,3)7 1 2 finger table keys startInt.Succ. 0[0,1)0 1[1,3)0 3[3,7)3 6 4 Successor 0 Predecessor 3 5 Successor 3 Predecessor 6 Successor 6 Predecessor 0 finger table keys startInt.Succ. 6[6,7) 7[7,1) 1[1,5) 7 7 3 Successor Predecessor 7 3 Initializing fingers and predecessor find_successor(6);
15
Hauptseminar „Peer-to-Peer Networks“ Technische Universität Yimei Liao Chemnitz 15 Chord Algorithm - Node joins 0 4 26 5 1 3 7 finger table keys startInt.Succ. 1 [1,2) 2 [2,4) 4 [4,0) 7 5 finger table keys startInt.Succ. 4[4,5)7 5[5,7)7 7[7,3)7 5 1 2 finger table keys startInt.Succ. 0[0,1)0 1[1,3)0 3[3,7) 6 4 Successor 0 Predecessor 3 5 Successor 3 Predecessor 6 Successor 7 Predecessor 0 5 finger table keys startInt.Succ. 6[6,7) 7[7,1) 1[1,5) 7 7 3 Successor Predecessor 7 3 5 Updating fingers of existing nodes 3 3 P = find_predecessor(n-2 i-1 ) i = 1, P = find_predecessor(4) i = 2, P = find_predecessor(3) i = 3, P = find_predecessor(1) 3 O(log 2 N)
16
Hauptseminar „Peer-to-Peer Networks“ Technische Universität Yimei Liao Chemnitz 16 Chord Algorithm - Node joins 0 4 26 5 1 3 7 finger table keys startInt.Succ. 1 [1,2) 3 2 [2,4) 3 4 [4,0) 7 6 finger table keys startInt.Succ. 4[4,5)7 5[5,7)7 7[7,3)7 5 1 2 finger table keys startInt.Succ. 0[0,1)0 1[1,3)0 3[3,7)3 6 4 Successor 0 Predecessor 3 5 Successor 3 Predecessor 6 Successor 6 Predecessor 0 5 finger table keys startInt.Succ. 6[6,7) 7[7,1) 1[1,5) 7 7 3 Successor Predecessor 7 3 5 Transferring Keys
17
Hauptseminar „Peer-to-Peer Networks“ Technische Universität Yimei Liao Chemnitz 17 Chord Algorithm – node joins Pseudocode for the node join operation
18
Hauptseminar „Peer-to-Peer Networks“ Technische Universität Yimei Liao Chemnitz 18 Chord Algorithm - Stabilization Stabilization Correctness and performance Keep node‘s successor pointers up to date Use successor pointers to verify correct finger table entries
19
Hauptseminar „Peer-to-Peer Networks“ Technische Universität Yimei Liao Chemnitz 19 Chord Algorithm - Stabilization Pseudocode for stabilization Join does not make the rest of the network aware of n Every node runs stabilize periodically, to verify the successor Use successor pointers to update finger tables. Node n asks its successor for the successor’s predecessor x. See if x should be n’s successor instead. (happens if x recently joined the system) Notify n’s successor of n’s exist. Successor changes its predecessor to n if it knows no closer predecessor than n.
20
Hauptseminar „Peer-to-Peer Networks“ Technische Universität Yimei Liao Chemnitz 20 Chord Algorithm – Node Failure Node Failure Successor-list If successor fails, replaces it with the first live entry in the list Later run stabilize to correct finger table and successor-list
21
Hauptseminar „Peer-to-Peer Networks“ Technische Universität Yimei Liao Chemnitz 21 Summary Characteristics of Chord Load balance distributed hash table Decentralization fully distributed Scalability cost of lookup grows logarithmic Availability automatically adjusts internal tables Flexible naming no constrains on the structure of the keys Routing HopsO(logN) ArrivalO(log 2 N) DepartureO(log 2 N)
22
Hauptseminar „Peer-to-Peer Networks“ Technische Universität Yimei Liao Chemnitz 22 References I. Stoica, R. Morris, D. Karger, F. Kaashoek, and H. Balakrishnan. Chord: A scalable Peer-To-Peer lookup service for internet applications. In Proceedings of the 2001 ACM SIGCOMM Conference, pages 149–160, 2001. R. Steinmetz, K. Wehrle (Edt.): "Peer-to-Peer Systems and Applications", LNCS 3485, Springer, Chapter 7-8, 2005. http://www.wikipedia.org http://www.google.com
23
Hauptseminar „Peer-to-Peer Networks“ Technische Universität Yimei Liao Chemnitz 23 Thank You Questions?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.