Network Security

Report
Kurt Tutschku
Vertretung - Professur Rechnernetze und verteilte Systeme
Technische Universität
Chemnitz
Chord - A Distributed Hash
Table
Yimei Liao
Outline
 Lookup problem in Peer-to-Peer systems and Solutions
 Chord Algorithm
–
–
–
–
Consistent Hashing
Scalable Key Location
Node joins
Stabilization
 Summary
Technische Universität
Yimei Liao
Hauptseminar „Peer-to-Peer Networks“
Chemnitz
2
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
Technische Universität
Yimei Liao
Hauptseminar „Peer-to-Peer Networks“
Chemnitz
3
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(N2)
Results are not guaranteed
Technische Universität
Yimei Liao
Hauptseminar „Peer-to-Peer Networks“
Chemnitz
4
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
Technische Universität
Yimei Liao
Hauptseminar „Peer-to-Peer Networks“
Chemnitz
5
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 2m (Chord ring)
– Key k is assigned to the first node whose identifier is equal to or
follows k.
Technische Universität
Yimei Liao
Hauptseminar „Peer-to-Peer Networks“
Chemnitz
6
Chord Algorithm – Consistent Hashing
identifier space : m=3
node key
0
1
1
2
3
6
1
0
6
1
7
identifier
circle
6
5
2
3
4
2
Technische Universität
Yimei Liao
Hauptseminar „Peer-to-Peer Networks“
Chemnitz
7
Chord Algorithm – Simple Key Lookup
 Simple Key Lookup
 Queries are passed
around the circle via
successor pointers
 Requires traversing all
Nodes to find the
appropriate mapping
Node 0 sends a
query for key 6
successor(0) = 1
1
0
1
7
6
successor(1) = 3
6
2
successor(6) = 0
5
3
4
successor(3) = 6
2
Technische Universität
Yimei Liao
Hauptseminar „Peer-to-Peer Networks“
Chemnitz
8
Chord Algorithm – Scalable Key Location
 Finger Table
– Each node n maintains a routing table with up to m entries
– The ith entry in the table at node n contains the identifier of the first
node s that succeeds n by at least 2i-1 on the identifier circle.(s =
successor(n+2i-1)).
– s is called the ith finger of node n.
 Definition of variables for node n
Technische Universität
Yimei Liao
Hauptseminar „Peer-to-Peer Networks“
Chemnitz
9
Chord Algorithm – Scalable Key Location
Finger table
m = 3, each node n maintains at most 3 entries
finger table
For. start
6+20 7
6+21 0
6+22 2
finger table
For. start
0+20 1
0+21 2
0+22 4
keys
Int.
[7,0)
[0,2)
[2,6)
Succ.
0
0
3
5
keys
Int.
[1,2)
[2,4)
[4,0)
Succ.
3
3
6
0
1
7
6
2
5
3
4
finger table
For. start
3+20 4
3+21 5
3+22 7
keys
Int.
[4,5)
[5,7)
[7,3)
Succ.
6
6
0
1
2
Technische Universität
Yimei Liao
Hauptseminar „Peer-to-Peer Networks“
Chemnitz
10
Chord Algorithm – Scalable Key Location
Pseudocode to find the successor node of an identifier
Find id’s successor by finding the
immediate predecessor of the id
Walk clockwise to find the
node which precedes id
and whose successor succeeds id
Start with the mth finger of node n
See if it comes between node n and
the id, if not, check the m-1th
finger until we find one wich does.
This is the closest node preceding id
among all the fingers of n
Technische Universität
Yimei Liao
Hauptseminar „Peer-to-Peer Networks“
Chemnitz
11
Chord Algorithm – Scalable Key Location
id=5
n=7
finger table
finger table
start
1
2
4
keys
start Int. Succ.
0
[0,1)
0
1
[1,3)
0
3
[3,7)
3
Successor
Predecessor
6
0
6
finger table
keys
start Int. Succ.
5
[5,6)
7
6
[6,0)
7
0
[0,4)
0
Successor
Predecessor
4
Successor
Predecessor
1
7
0
4
2
successor(5) = 7
5
Int.
[1,2)
[2,4)
[4,0)
3
4
keys
Succ.
3
3
4
3
7
finger table
keys
start Int. Succ.
4
4
[4,5)
5
[5,7)
7
7
[7,3)
7
Successor
Predecessor
1
2
4
0
7
3
O(logN)
Technische Universität
Yimei Liao
Hauptseminar „Peer-to-Peer Networks“
Chemnitz
12
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
Technische Universität
Yimei Liao
Hauptseminar „Peer-to-Peer Networks“
Chemnitz
13
Chord Algorithm - Node joins
Initializing fingers and predecessor
finger table
Successor
Predecessor
6
4
0
6
keys
start Int. Succ.
7
6
[6,7)
7
[7,1)
7
1
[1,5)
3
7
Successor
3
Predecessor
2
5
Int.
[1,2)
[2,4)
[4,0)
Successor
Predecessor
1
7
0
53
finger table
start
1
2
4
find_successor(6);
keys
start Int. Succ.
0
[0,1)
0
1
[1,3)
0
3
[3,7)
3
finger table
3
4
keys
Succ.
3
3
7
3
6
finger table
keys
start Int. Succ.
4
[4,5)
7
5
[5,7)
7
7
[7,3)
7
Successor
Predecessor
1
2
6
0
Technische Universität
Yimei Liao
Hauptseminar „Peer-to-Peer Networks“
Chemnitz
14
Chord Algorithm - Node joins
Updating fingers of existing nodes
finger table
start
1
2
4
keys
start Int. Succ.
0
[0,1)
0
1
[1,3)
0
3
[3,7)
3
Successor
Predecessor
finger table
6
4
0
6
finger table
keys
start Int. Succ.
7
6
[6,7)
7
[7,1)
7
1
[1,5)
3
7
Successor
3
Predecessor
Successor
Predecessor
1
7
0
53
2
5
Int.
[1,2)
[2,4)
[4,0)
3
4
keys
Succ.
3
3
7
5
3
6
finger table
keys
start Int. Succ.
57
4
[4,5)
5
[5,7)
57
7
[7,3)
7
Successor
Predecessor
1
2
57
0
P = find_predecessor(n-2i-1)
i = 1, P = find_predecessor(4)
2
i = 2, P = find_predecessor(3)
i = 3, P = find_predecessor(1)
O(log N)
Technische Universität
Yimei Liao
Hauptseminar „Peer-to-Peer Networks“
Chemnitz
15
Chord Algorithm - Node joins
Transferring Keys
finger table
start
1
2
4
keys
start Int. Succ.
0
[0,1)
0
1
[1,3)
0
3
[3,7)
3
Successor
Predecessor
finger table
6
4
0
6
finger table
keys
start Int. Succ.
7
6
[6,7)
7
[7,1)
7
1
[1,5)
3
7
Successor
3
Predecessor
Successor
Predecessor
1
7
0
53
2
5
Int.
[1,2)
[2,4)
[4,0)
3
4
keys
Succ.
3
3
67
3
6
finger table
keys
start Int. Succ.
57
4
[4,5)
5
[5,7)
57
7
[7,3)
7
Successor
Predecessor
1
2
56
0
Technische Universität
Yimei Liao
Hauptseminar „Peer-to-Peer Networks“
Chemnitz
16
Chord Algorithm – node joins
Pseudocode for the node join operation
Technische Universität
Yimei Liao
Hauptseminar „Peer-to-Peer Networks“
Chemnitz
17
Chord Algorithm - Stabilization
 Stabilization
 Correctness and performance
 Keep node‘s successor pointers up to date
 Use successor pointers to verify correct finger table entries
Technische Universität
Yimei Liao
Hauptseminar „Peer-to-Peer Networks“
Chemnitz
18
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
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.
Use successor pointers to
update finger tables.
Technische Universität
Yimei Liao
Hauptseminar „Peer-to-Peer Networks“
Chemnitz
19
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
Technische Universität
Yimei Liao
Hauptseminar „Peer-to-Peer Networks“
Chemnitz
20
Summary
 Characteristics of Chord

Load balance
distributed hash table

Decentralization
fully distributed

Scalability
cost of lookup grows logarithmic

Routing Hops
O(logN)
Arrival
O(log2N)
Departure
O(log2N)
Availability
automatically adjusts internal tables

Flexible naming
no constrains on the structure of the keys
Technische Universität
Yimei Liao
Hauptseminar „Peer-to-Peer Networks“
Chemnitz
21
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
Technische Universität
Yimei Liao
Hauptseminar „Peer-to-Peer Networks“
Chemnitz
22
Thank You
Questions?
Technische Universität
Yimei Liao
Hauptseminar „Peer-to-Peer Networks“
Chemnitz
23

similar documents