1 / 30

Skip Net (9/11/05)

Skip Net (9/11/05). Introduction Based on Skip Lists What are they? An alternative to binary trees , Binary trees work well with random input but do not work well say when inserting items in order Thus in general, binary trees need to be load balanced

aliza
Télécharger la présentation

Skip Net (9/11/05)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Skip Net (9/11/05)

  2. Introduction Based on Skip Lists What are they? An alternative to binary trees, Binary trees work well with random input but do not work well say when inserting items in order Thus in general, binary trees need to be load balanced Can we avoid load balancing of binary trees by introducing some form of randomness in the load balancing procedure – what if the position (level) of a node in the tree is determined by a random number generator? Skip List:a sorted linked list with extra links

  3. Introduction Skip List:a sorted linked listwhere some nodes have pointers that skip over many list elements, why? n/2 n/4 n/8 n/16 How to use the extra pointers: For example, in case (b), as long as you have not reached a node with key > search-key, use level 2 pointers, then use level 1, n/2 + 1 In general, level = top-level, log n with only doubling while not found, the number of pointers while key > search-key use level level = level – 1 /*use lower level */

  4. Level 0 Level 1 (length 21) Level 2 (length 22) Skip List a sorted linked list in which some nodes are supplementedwith pointers that skip over many list elements “perfect”Skip List: the height of the ith node isthe exponent of the largest power-of-two that divides i. Pointers atlevel h have length 2h(i.e., they traverse 2hnodes). Aperfect Skip List supports searches in O(logN) time. Level 3 (length 23)

  5. Probabilistic Skip List Insertionsand deletions are very expensive Aprobabilistic scheme for determining node heightswhile maintaining O(logN) searches with high probability Each node chooses a height such that the probabilityof choosing height h is 1/2h. (why? Hint: number of nodes at each level) Thus, with probability½a node has height 1, with probability ¼, it hasheight 2, etc.

  6. How to use them in P2P • in-memory data structure link together distributed computer nodes • traversed from its head node traversal may start from any node in thesystem (ring) • ahighly variable number of pointers per data record and a substantially different amount of traversal trafficat each data record the state and processing overhead of all nodesroughly the same

  7. The Skip Net Structure Replace data records with computernodes, using the string name IDs of the nodes as the datarecord keys Form a ring instead of a list (the ring isdoubly-linked to enable path locality)

  8. The Skip Net Structure (continued) Each SkipNet node stores2 logNpointers, where N is the number of nodes in theoverlay system Routing Table or R-Table of a node (its set of pointers) The pointers at levelh of a given node’s routing table point to nodes that areroughly 2hnodes to the left and right of the given node. “perfect” SkipNet: eachlevel h pointer traverses exactly 2hnodes.

  9. The Skip Net Structure (continued) Root Ring All nodes are connected by the root ring formed by eachnode’s pointers at level 0. – Note that these nodes are sorted by Name ID. Pointers at level 1 point tonodes that are 2 nodes away -> theoverlay nodesaredivided into 2 disjoint rings. Pointers at level 2 form 4 disjoint rings of nodes, andso forth. Note: rings at level h + 1 are obtained bysplitting a ring at level h into two disjoint sets, eachringcontaining every second member of the level h ring.

  10. The Probabilistic Skip Net Structure • Each ring at level h is split into two rings by having each node randomly and uniformly decide to which of the two rings it belongs • Insertion and deletion affects only two other nodes in each ring to which the node has randomly chosen to belong • A pointer at level h still skips 2h nodes in expectation and routing is possible in O(log N) forwarding hops with high probability

  11. Skip Net’s Numeric ID Space Each node’s random choice of ring memberships can be encoded as a unique binary number: the node’s numeric ID Thefirst h bits of the number determine ring membership atlevel h. For example, node X’s numeric ID is 011 and itsmembership at level 2 is determined by taking the first2 bits of 011, which designate Ring 01.

  12. The Probabilistic Skip Net Structure (continued) does not requirehashing to generate nodes’numeric IDs; it only requires that numeric IDs are random andunique • Node IDs and Numeric IDs • Numeric IDs of nodes are unique; they canbe thought of as asecond address space maintainedby the same SkipNet • SkipNet’sstring (name) address space is populated by node name IDs thatare not uniformly distributed throughout the space • SkipNet’s numericaddress space is populated by node numericIDs that areuniformlydistributed

  13. The Skip Net Structure (continued) The rootring, at the bottom, is sorted by name ID and, collectively,thetop-level rings are sorted by numeric ID. For any givennode, the SkipNet rings to which it belongs precisely forma Skip List. If you construct a trie on all nodes’numeric IDs, the nodes ofthe resulting trie would be inone-to-one correspondence with the SkipNet rings.

  14. Skip Net’s Address Spaces • Skip Net maintains two address spaces for the nodes: • Node ID space (which is not uniformly distributed through the address space) • Numeric ID space (it does not require hashing, it suffices that they are random and unique)

  15. CHORD and Probabilistic Skip Net • SkipNet’s routing pointers are exponentially distributed ina manner similar to Chord’s: The pointer at level h hopsover 2hnodes in expectation. • Chord’s routing pointers skip over 2hinthe numeric space • SkipNet’s pointers: • whenconsidered fromlevel 0 upward, skip over 2hnodes inthe name ID space • whenconsidered from the toplevel downward, skip over 2hnodes in thenumeric IDspace.

  16. CHORD and Probabilistic Skip Net Chord guarantees O(logN) routing and node insertionperformance by uniformly distributing node identifiersin its numeric address space. Hash(nodeID)  [0, 2m] SkipNet guaranteesO(logN) performance of node insertion and routing inboth the name ID and numeric ID spaces by uniformlydistributing numeric IDs and leveraging the sorted orderof name IDs.

  17. Skip Net • By using names instead of hashed identifiers to order nodes, natural locality based on the names of objects is preserved • Arrange content in name order rather than randomly • Path locality, and • Content locality Q: Can we achieve the same using an order-preserving hash function?

  18. Routing by Name ID Similar with Skip Lists Followpointers that route closest to the intended destination At each node, a message will be routed along the highestlevelpointer that does not point past the destination value. Routing terminates when the message arrives at a nodewhose name ID is closest to the destination. Since nodes are ordered by name ID along each ringand a message is never forwarded past its destination, allnodes encountered during routing have name IDs betweenthe source and the destination Given a source node and a destination node, if destination > source, move clockwise else move counter clockwise

  19. Routing by Name ID Content locality Use the name id of an item to store it (map it) to the p2p nodes Use the “name” of the data item to store it at the node with the same name (or the same prefix) Incorporating the node’s name ID into a data name ID guarantees that the data item will be stored at that node Example: doc-name -> kostas.microsoft.com/doc-name Path locality Use com.microsoft.kostas so that all nodes within the com.microsoft prefix share a single DNS suffix

  20. Routing by Name ID (continued) When a messageoriginates at a node whose name ID shares a commonprefix with the destination: All nodes traversed by the messagehave name IDs that share that same prefix If the source name ID and the destination name IDshare no commonprefix: A message can be routed in eitherdirection. For the sake offairness, randomly pick a directionso that nodes whose name IDs arenear the middleof the sorted ordering do not get a disproportionatelylargeshare of the forwarding traffic.

  21. Routing by Name ID (continued) The number of message hops when routing by nameID is O(logN) with high probability. The key observation of this scheme is that routingby name ID traverses only nodes whose name IDs share anon-decreasing prefix with the destination ID.

  22. Routing by Numeric ID Begin byexamining nodes in the level 0 ring until anode is foundwhose numeric ID matches the destination numeric ID inthe 1st digit. Jump upto this node’s level 1 ring, which also contains the destinationnode. Examine nodes inthis level 1 ring until a node isfound whose numeric IDmatches the destination numeric ID in the 2nd digit. Again, this node’s level 2 ring must alsocontain the destination node,and thus the routing operationproceeds in this level 2 ring. This procedure repeats until we cannot make any moreprogress — we have reached a ring at some level h suchthat none of the nodes in thatring share h + 1 digits withthe destination numeric ID. We must now deterministicallychoose one of the nodes in this ring to be the destination node. Define the destination nodeto be the node whose numeric ID is numerically closest todestination numeric ID amongst all nodes in this highestring.

  23. Routing by Numeric ID (continued) Example: Route a message fromnode A to destination 1011 A will firstforward themessage to node D because D is in ring 1. D will thenforward themessage to node O because O is in ring 10. O will forward the message to Zbecause it is not in ring101. Z will forward the message onward around the ring(and hence back) to O for the same reason. Since noneof the members of ring 10 belong to ring 101, node Owill be picked as the final message destination because itsnumeric ID is closest to 1011 of all ring 10 members.

  24. Routing • The number of message hops when routing by numeric ID is O(logN) with high probability. • Route by name ID: from top (higher level h) downwards • Route by numeric ID: from bottom (lowest level, level 0) upwards • Efficient searches by name ID, because for any givennode, the SkipNet rings to which it belongs precisely forma Skip List. • Efficient searches by numeric ID, because, if you construct a trie on all nodes’numeric IDs, the nodes of the resulting trie would be inone-to-one correspondence with the SkipNet rings. • To map items • Use name ID (for content locality) • Use Numeric ID (for load balancing)

  25. Node Join • A node wanting to join the network must know at leastone node inside the network and sends a JOIN requestto that node. • Select a numeric ID either randomly or use hashing Where to join (position in the rings): • Phase 1: First, find your position at each level, the correct ring at the level (use Numeric ID) • Phase 2: Then, find the correct position in the ring (must be sorted by name ID)

  26. Node Join Phase 1 First find the toplevelring thatcorresponds to the newcomer’s numeric ID. This amounts to routing a message to the newcomer’s numericID. Phase 2 (the toplevel ring is found, search by name ID) The newcomer then finds its neighbors in this toplevelring, using a search by name ID within this ringonly. Starting from one of these neighbors, the newcomersearches for its name ID at the next lower level and thusfinds its neighbors at this lower level. This process is repeatedfor each level until the newcomer reaches the rootring. For correctness, the existing nodes only point to thenewcomer after it hasjoined the root ring; the newcomerthen notifies its neighbors in each ringthat it should beinserted next to them.

  27. Node Join (continued) Example: Insert node O STEP 1 Node O initiates a search by numeric IDfor its own ID (101) and ends up at node Z in ring 10 since that is the highest nonemptyring that shares a prefix with node O’snumeric ID. STEP 2: Since Z is the only node in ring 10, Z concludes that itis both the clockwise and counter-clockwise neighbor ofnode O in this ring. To find node O’s neighbors in the next lowerring (ring 1), Z forwards the insertion message toD. Node D then concludes that D and V are theneighbors of node O in ring 1. Similarly, node D forwardsthe insertion message to node M in the root ring,who concludes that node O’s level 0 neighbors must be Mand T. STEP 3: The insertion message is returned to node O, whothen instructs all of its neighbors to insert it into the rings.

  28. Node Join (continued) A newcomer searches for its neighbors at a certainlevel only after finding its neighbors at all higher levels. As a result, the search by name ID will traverse only a fewnodes within each ring to be joined: The range of nodestraversed at each level is limited to the range between thenewcomer’s neighbors at the next higher level. Therefore,with high probability, a node join in SkipNet will traverseO(logN) hops

  29. Node Departure SkipNet can route correctly as long as the bottomlevel ring is maintained. All pointers but the level 0 onescan be regarded as routing optimization hints, and thusare not necessary to maintain routing protocol correctness. Therefore (like Chord and Pastry) SkipNet maintainsand repairs the upper-level ring memberships by meansof a background repair process. In addition, when a nodevoluntarily departs from the SkipNet, it can proactivelynotify all of its neighbors to repair their pointers immediately. To maintain the root ring correctly, each SkipNet nodemaintains a leaf set that points to additional nodes alongthe root ring, for redundancy. In the current implementationa leaf set size of 16.

  30. More next time

More Related