430 likes | 597 Views
SKIP GRAPHS. Level 2. Level 1. Level 0. James Aspnes Gauri Shah To appear in SODA 2003. Outline. Peer-to-peer systems Existing approach: Distributed Hash Tables Our Approach: Skip Graphs Algorithms and Properties Experimental Results Conclusions and open problems. Peers.
E N D
SKIP GRAPHS Level 2 Level 1 Level 0 James Aspnes Gauri Shah To appear in SODA 2003.
Outline • Peer-to-peer systems • Existing approach: Distributed Hash Tables • Our Approach: Skip Graphs • Algorithms and Properties • Experimental Results • Conclusions and open problems
Peers Resources P2P system Key • Bunch of peers. • Store resources identified by keys. • Peers subject to crash failures. • Goal: locate resources efficiently.
Properties of ideal network • Data availability • Decentralization • Fault-tolerance • Scalability • Load balancing • Maintaining the network • Dynamic node addition/deletion • Self-stabilization • Efficient searching • Incorporating geography • Incorporating locality [temporal, spatial]
Gnutella ? Inefficient flooding Early P2P systems Napster x ? x x Central server bottleneck
427 768 368 123 327 365 135 360 Tapestry [JKZ’01] Uses Plaxton’s Algorithm: Node xyz links to *XX, x*X and xy* [* = all digits, X = any digit] Correct one digit at a time to reach target. Pastry [DR’01] is also similar.
CAN [RFHKS’01] Partition d-dimensional co-ordinate space into zones. (0,1) (1,1) zone 3 5 d=2 7 2 8 (1,0) (0,0) Nodes own zones and keys hashed to them. Greedy routing: forward to neighbor closest to target.
3 3 6 Chord [SMKKB‘01] Nodes and resources mapped to identifier circle. Routing table: successor nodes at distances . 0 7 1 successors identifier circle (n=8) 0 0 3 6 2 6 6 0 3 5 4 Greedyrouting: forward to node in routing table closest to target.
Distributed Hash Tables Virtual Route v4 Nodes Keys v2 v1 HASH Physical Link v3 Virtual Link v1 v2 v3 v4 Actual Route PHYSICAL NETWORK VIRTUAL OVERLAY NETWORK
Advantages Disadvantages • Load balancing. • Decentralization. • O(log n) space and search time. • O(log2n) insert and delete time [search for (log n) neighbors]. • Tolerance of random faults. • No locality properties. • No tolerance to adversarial faults. • No self-stabilization. • No optimization wrt. geography. SKIP GRAPHS
Level 2 J Level 1 A J M 0 1 0 1 0 1 1 0 0 Skip List [Pugh ’90] Data structure based on a linked list. TAIL HEAD Level 0 A G J M R W Each node linked at higher level with probability 1/2.
Searching in a skip list Search for key ‘R’ HEAD TAIL success failure J Level 2 A J M Level 1 Level 0 A G J M R W - + Time for search: O(log n) on average. On average, constant number of pointers per node.
Skip lists for P2P? Advantages • O(log n) expected search time. • Retains locality. • Dynamic node additions/deletions. Disadvantages • Heavily loaded top-level nodes. • Easily susceptible to random failures. • Lacks redundancy.
A Skip Graph W G Level 2 A J M R 101 100 000 001 011 110 G R W Level 1 A J M 110 101 100 001 001 011 Membership vectors A J M R W G Level 0 001 001 100 011 110 101 Link at level i to nodes with matching prefix of length i. Think of a tree of skip lists that share lower layers.
Properties of skip graphs • Searching. • Node insertions. • Independence from system size. • Locality and range queries.
Searching: avg. O (log n) Restricting to the lists containing the starting element of the search, we get a skip list. G W Level 2 A J M R G R W Level 1 A J M A G J M R W Level 0 Same performance as DHTs.
5 3 1 2 4 6 7 9 11 12 10 8 1 3 5 7 9 11 2 4 6 8 10 12 Design aspects Use doubly linked lists at each level to account for absence of head and tail nodes. So search can start at any node. Cannot use circular singly-linked list because it is hard to detect and repair an error like this: Level 0
J 001 Node Insertion – 1 buddy new node W G Level 2 M R A 101 100 000 011 110 R G W Level 1 A M 110 101 100 001 011 A R G M W Level 0 001 100 011 110 101 Starting at buddy node, find nearest key at level 0. Basically a range query looking for key closest to new key. Takes O(log n) on average.
J J J 001 001 001 Node Insertion - 2 At each level i, find nearest node with matching prefix of membership vector of length i+1. W G Level 2 M R A 101 100 000 011 110 G R W Level 1 A M 110 101 100 001 011 A R G M W Level 0 001 100 011 110 101 Total time for insertion: O(log n) DHTs take: O(log2n)
J Z Level 2 E insert J J Z E Level 1 00 01 J Z E Level 0 1 0 0 Independent of system size No need to know size of keyspace or number of nodes. Z E Level 1 Z E Level 0 1 0 Old nodes extend membership vector as required with arrivals. DHTs require knowledge of keyspace size initially.
Locality and range queries • Find key < F, > F. • Find largest key < x. • Find least key > x. • Find all keys in interval [D..O]. • Initial node insertion at level 0. D F A I D F A I O S L
Applications of locality Version Control e.g. find latest news from yesterday. find largest key < news:10/29. Level 0 news:10/25 news:10/26 news:10/27 news:10/28 news:10/29 Data Replication e.g. find any copy of some Britney Spears song. Level 0 britney01 britney02 britney03 britney04 britney05 DHTs cannot do this easily as hashing destroys locality.
Coming up... • Load balancing. • Tolerance to faults. • Self-stabilization. • Random faults. • Adversarial faults. So far... Decentralization. Locality properties. O(log n) space per node. O(log n) search, insert, and delete time. Independent of system size.
Load balancing Interested in average load on a node u. i.e. the number of searches from source s to destination t that use node u. Theorem: Let dist (u, t) = d. Then the probability that a search from s to t passes through u is < 2/(d+1). where V = {nodes v: u <= v <= t} and |V| = d+1.
Nodes u Skip list restriction s Level 2 Level 1 Level 0 Node u is on the search path from s to t only if it is in the skip list formed from the lists of s at each level.
s u u u t d+1 Pr [u T] = Pr[|T|=k] • k/(d+1) = E[|T|]/(d+1). k=1 Tallest nodes s u is not on path. u is on path. u u t Node u is on the search path from s to t only if it is in T = the set of k tallest nodes in [u..t]. Heights independent of position, so distances are symmetric.
= T Load on node u Start with n nodes. Each node goes to next set with prob. 1/2. We want expected size of T = last non-empty set. We show that: E[|T|] < 2. Asymptotically: E[|T|] = 1/(ln 2) 2x10-5 1.4427… [Trie analysis] Average load on a node is inversely proportional to the distance from the destination. We also show that the distribution of average load declines exponentially beyond this point.
1.1 1.0 Expected load Actual load Destination = 76542 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0.0 76400 76450 76500 76550 76600 76650 Experimental result Load on node Node location
Fault tolerance How do node failures affect skip graph performance? Random failures: Randomly chosen nodes fail. Experimental results. Adversarial failures: Adversary carefully chooses nodes that fail. Bound on expansion ratio.
Random faults 131072 nodes
Searches with random failures 131072 nodes 10000 messages
Adversarial faults dA = nodes adjacent to A but not in A. Expansion ratio = min |dA|/|A|, 1 <= |A| <= n/2. A dA Theorem: A skip graph with n nodes has expansion ratio = (1/log n). f failures can isolate only O(f•log n ) nodes.
Proof intuition Consider neighbors of set A at level 0. A Level 0 1. Clumpy sets dA Low probability of clumpy sets. A A 2. Non-clumpy sets Level 0 Non-clumpy sets have many neighbors at level 0. Gives high expansion ratio.
Expansion ratio All sets have low probability of few neighbors at level h. And there are not too many clumpy sets. Low probability that any set A has few neighbors at level 0 or h. This gives expansion ratio = (1/log n). Same analysis applicable to DHTs?
Need for repair mechanism G W Level 2 A J M R R W G Level 1 A J M A G J R W M Level 0 Node failures can leave skip graph in inconsistent state.
Successor constraints 2 1 xR xR i-1 i-1 xR i x Level i k k xRi = xRi-1. xLi = xLi-1. x Level i-1 ..00.. ..01.. ..00.. Ideal skip graph Let xRi (xLi) be the right (left) neighbor of x at level i. If xLi, xRi exist: xLi < x < xRi. xLiRi = xRiLi = x. Invariant
1 1 1 2 5 5 5 6 6 4 Basic repair If a node detects a missing neighbor, it tries to patch the link using other levels. 3 3 Also relink at other lower levels. Successor constraints may be violated by node arrivals or failures.
x x ..00.. ..01.. ..01.. zipper ..01.. ..00.. ..01.. x Level i x Level i-1 Constraint violation Neighbor at level i not present at level (i-1). Level i x x Level i-1 ..00.. ..01.. ..01.. ..01.. ..00.. ..01.. ..01.. ..01..
Self-stabilization zOp(B) zOp(E) zOp(I) A C D F J zipperOp message Level i B E G H I zOp(A) zOp(D) zOp(F) Eventually want each connected component of the skip graph to reorganize itself into an ideal skip graph.
Conclusions Similarities with DHTs • Decentralization. • O(log n) space at each node. • O(log n) search time. • Load balancing properties. • Tolerant of random faults.
? Open Problems • Design efficient repair mechanism. • Incorporate geographical proximity. • Study multi-dimensional skip graphs. • Evaluate performance in practice. • Study effect of byzantine failures.