A Scalable Peer To Peer Lookup Service For Internet Applications

  • Published on
    11-May-2015

  • View
    620

  • Download
    1

Embed Size (px)

Transcript

<ul><li>1.Chord: A Scalable Peer-to-Peer Lookup Service for Internet Applications <ul><li><ul><li>Ion Stoica Robert Morris </li></ul></li></ul></li></ul> <ul><li><ul><li>David Liben-Nowell David R. Karger </li></ul></li></ul> <ul><li><ul><li>M. Frans Kaashoek Frank Dabek </li></ul></li></ul> <ul><li><ul><li>Hari Balakrishnan </li></ul></li></ul> <ul><li>Presented By- </li></ul> <ul><li>Manan Rawal, Bhaskar Gupta </li></ul> <p>2. Introduction </p> <ul><li>Efficient lookup of a node which stores data items for a particular search key. </li></ul> <ul><li>Provides only one operation: given a key, it maps the key onto a node. </li></ul> <ul><li>Example applications: </li></ul> <ul><li><ul><li>Co-operative Mirroring </li></ul></li></ul> <ul><li><ul><li>Time-shared storage </li></ul></li></ul> <ul><li><ul><li>Distributed indexes </li></ul></li></ul> <ul><li><ul><li>Large-Scale combinatorial search </li></ul></li></ul> <p>3. Problems addressed </p> <ul><li>Load Balance: Distributed hash function spreads keys evenly over the nodes </li></ul> <ul><li>Decentralization: Fully distributed </li></ul> <ul><li>Scalability: Lookup grows as a log of number of nodes </li></ul> <ul><li>Availability: Automatically adjusts internal tables to reflect changes. </li></ul> <ul><li>Flexible Naming: No constraints on key structure. </li></ul> <p>4. Chord Protocol </p> <ul><li>Assumes communication in underlying network is both symmetric and transitive. </li></ul> <ul><li>Assigns keys to nodes withconsistent hashing </li></ul> <ul><li>Hash function balances the load </li></ul> <ul><li>When N thnode joins or leaves only O(1/N) fraction of keys moved. </li></ul> <p>5. Chord protocol </p> <ul><li>Consistent hashing function assigns each node and key an m-bit identifier using SHA-1 base hash function. </li></ul> <ul><li>Nodes IP address is hashed. </li></ul> <ul><li>Identifiers are ordered on a identifier circle modulo 2 mcalled a chord ring. </li></ul> <ul><li>succesor(k)= first node whose identifier is &gt;= identifier of k in identifier space. </li></ul> <p>6. Chord protocol m = 6 10 nodes 7. Theorem </p> <ul><li>For any set of N nodes and K keys, withhigh probability : </li></ul> <ul><li><ul><li>Each node is responsible for at most (1+e)K/N keys. </li></ul></li></ul> <ul><li><ul><li>When an (N+1) stnode joins or leaves the network, responsibility for O(K/N) keys changes hands. </li></ul></li></ul> <ul><li>e = O(log N) </li></ul> <p>8. Simple Key Location Scheme N1 N8 N14 N21 N32 N38 N42 N48 K45 9. Scalable Lookup Scheme N1 N8 N14 N21 N32 N38 N42 N48 N51 N56 Finger Table for N8 finger1,2,3 finger4 finger6 finger [k]=first node that succeeds(n+2 k-1 )mod2 m finger5 N42 N8+32 N32 N8+16 N21 N8+8 N14 N8+4 N14 N8+2 N14 N8+1 10. Scalable Lookup Scheme </p> <ul><li>// ask nodento find the successor ofid </li></ul> <ul><li>n.find_successor(id) </li></ul> <ul><li>if(id belongs to (n,successor ]) </li></ul> <ul><li>returnsuccessor ; </li></ul> <ul><li>else </li></ul> <ul><li>n0 = closest preceding node(id); </li></ul> <ul><li>returnn0. find_successor (id); </li></ul> <ul><li>// search the local table for the highest predecessor ofid </li></ul> <ul><li>n.closest_preceding_node(id) </li></ul> <ul><li>fori = mdownto1 </li></ul> <ul><li>if( finger [i] belongs to (n, id)) </li></ul> <ul><li>returnfinger [i]; </li></ul> <ul><li>returnn; </li></ul> <p>11. Lookup Using Finger Table N1 N8 N14 N21 N32 N38 N42 N51 N56 N48 lookup(54) 12. Scalable Lookup Scheme </p> <ul><li>Each node forwards query at least halfway along distance remaining to the target </li></ul> <ul><li>Theorem: With high probability, the number of nodes that must be contacted to find a successor in a N-node network is O(log N) </li></ul> <p>13. Dynamic Operations and Failures </p> <ul><li>Need to deal with: </li></ul> <ul><li><ul><li>Node Joins and Stabilization </li></ul></li></ul> <ul><li><ul><li>Impact of Node Joins on Lookups </li></ul></li></ul> <ul><li><ul><li>Failure and Replication </li></ul></li></ul> <ul><li><ul><li>Voluntary Node Departures </li></ul></li></ul> <p>14. Node Joins and Stabilization </p> <ul><li>Nodes successor pointer should be up to date </li></ul> <ul><li><ul><li>For correctly executing lookups </li></ul></li></ul> <ul><li>Each node periodically runs a Stabilization Protocol </li></ul> <ul><li><ul><li>Updates finger tables and successor pointers </li></ul></li></ul> <p>15. Node Joins and Stabilization </p> <ul><li>C ontains 6 functions: </li></ul> <ul><li><ul><li>create() </li></ul></li></ul> <ul><li><ul><li>join() </li></ul></li></ul> <ul><li><ul><li>stabilize() </li></ul></li></ul> <ul><li><ul><li>notify() </li></ul></li></ul> <ul><li><ul><li>fix_fingers() </li></ul></li></ul> <ul><li><ul><li>check_predecessor() </li></ul></li></ul> <p>16. Create() </p> <ul><li>Creates a new Chord ring </li></ul> <ul><li>n . create () </li></ul> <ul><li>predecessor = nil; </li></ul> <ul><li>successor = n; </li></ul> <p>17. Join() </p> <ul><li>Asks m to find the immediate successor of n. </li></ul> <ul><li>Doesnt make rest of the network aware of n. </li></ul> <ul><li>n . join (m) </li></ul> <ul><li>predecessor = nil; </li></ul> <ul><li>successor = m . find_successor(n); </li></ul> <p>18. Stabilize() </p> <ul><li>Called periodically to learn about new nodes </li></ul> <ul><li>Asks ns immediate successor about successors predecessor p </li></ul> <ul><li><ul><li>Checks whether p should be ns successor instead </li></ul></li></ul> <ul><li><ul><li>Also notifies ns successor about ns existence, so that successor may change its predecessor to n, if necessary </li></ul></li></ul> <ul><li>n . stabilize () </li></ul> <ul><li>x = successor . predecessor; </li></ul> <ul><li>if (x(n ,successor)) </li></ul> <ul><li>successor = x; </li></ul> <ul><li>successor . notify(n); </li></ul> <p>19. Notify() </p> <ul><li>m thinks it might be ns predecessor </li></ul> <ul><li>n . notify (m) </li></ul> <ul><li>if (predecessor is nil or m(predecessor ,n)) </li></ul> <ul><li>predecessor = m; </li></ul> <p>20. Fix_fingers() </p> <ul><li>Periodically called to make sure that finger table entries are correct </li></ul> <ul><li><ul><li>New nodes initialize their finger tables </li></ul></li></ul> <ul><li><ul><li>Existing nodes incorporate new nodes into their finger tables </li></ul></li></ul> <ul><li>n .fi x _fi ngers () </li></ul> <ul><li>next = next + 1 ; </li></ul> <ul><li>if (next &gt; m) </li></ul> <ul><li>next = 1 ; </li></ul> <ul><li>finger[next] = find_successor(n + 2 next -1 ); </li></ul> <p>21. Check_predecessor() </p> <ul><li>Periodically called to check whether predecessor has failed </li></ul> <ul><li><ul><li>If yes, it clears the predecessor pointer, which can then be modified bynotify() </li></ul></li></ul> <ul><li>n . check _ predecessor () </li></ul> <ul><li>if (predecessor has failed) </li></ul> <ul><li>predecessor = nil; </li></ul> <p>22. Theorem 3 </p> <ul><li>If any sequence of join operations is executed interleaved with stabilizations, then at some time after the last join the successor pointers will form a cycle on all nodes in the network </li></ul> <p>23. Stabilization Protocol </p> <ul><li>Guarantees to add nodes in a fashion to preserve reach ability </li></ul> <ul><li>By itself wont correct a Chord system that has split into multiple disjoint cycles, or a single cycle that loops multiple times around the identifier space </li></ul> <p>24. Impact of Node Joins on Lookups </p> <ul><li>Correctness </li></ul> <ul><li><ul><li>If finger table entries are reasonably current </li></ul></li></ul> <ul><li><ul><li><ul><li>Lookup finds the correct successor in O(log N) steps </li></ul></li></ul></li></ul> <ul><li><ul><li>If successor pointers are correct but finger tables are incorrect </li></ul></li></ul> <ul><li><ul><li><ul><li>Correct lookup but slower </li></ul></li></ul></li></ul> <ul><li><ul><li>If incorrect successor pointers </li></ul></li></ul> <ul><li><ul><li><ul><li>Lookup may fail </li></ul></li></ul></li></ul> <p>25. Impact of Node Joins on Lookups </p> <ul><li>Performance </li></ul> <ul><li><ul><li>If stabilization is complete </li></ul></li></ul> <ul><li><ul><li><ul><li>Lookup can be done in O(log N) time </li></ul></li></ul></li></ul> <ul><li><ul><li>If stabilization is not complete </li></ul></li></ul> <ul><li><ul><li><ul><li>Existing nodes finger tables may not reflect the new nodes </li></ul></li></ul></li></ul> <ul><li><ul><li><ul><li><ul><li>Doesnt significantly affect lookup speed </li></ul></li></ul></li></ul></li></ul> <ul><li><ul><li><ul><li>Newly joined nodes can affect the lookup speed, if the new nodes IDs are in between target and targets predecessor </li></ul></li></ul></li></ul> <ul><li><ul><li><ul><li><ul><li>Lookup will have to be forwarded through the intervening nodes, one at a time </li></ul></li></ul></li></ul></li></ul> <p>26. Theorem 4 </p> <ul><li>If we take a stable network with N nodes with correct finger pointers, and another set of up to N nodes joins the network, and all successor pointers (but perhaps not all finger pointers) are correct, then lookups will still take O(log N) time with high probability</li></ul> <p>27. Failure and Replication </p> <ul><li>Correctness of the protocol relies on the fact of knowing correct successor </li></ul> <ul><li>To improve robustness </li></ul> <ul><li><ul><li>Each node maintains a successor list of r nodes </li></ul></li></ul> <ul><li><ul><li>This can be handled using modified version ofstabilizeprocedure </li></ul></li></ul> <ul><li><ul><li>Also helps higher-layer software to replicate data </li></ul></li></ul> <p>28. Theorem 5 </p> <ul><li>If we use successor list of length r =O(log N) in a network that is initially stable, and then every node fails with probability , then with high probabilityfind_successorreturns the closest living successor to the query key </li></ul> <p>29. Theorem 6 </p> <ul><li>In a network that is initially stable, if every node fails with probability , then the expected time to executefind_successoris O(log N) </li></ul> <p>30. Voluntary Node Departures </p> <ul><li>Can be treated as node failures </li></ul> <ul><li>Two possible enhancements </li></ul> <ul><li><ul><li>Leaving node may transfers all its keys to its successor </li></ul></li></ul> <ul><li><ul><li>Leaving node may notify its predecessor and successor about each other so that they can update their links </li></ul></li></ul> <p>31. Conclusion </p> <ul><li>Efficient location of the node that stores a desired data item is a fundamental problem in P2P networks </li></ul> <ul><li>Chord protocol solves itin a efficient decentralized manner </li></ul> <ul><li><ul><li>Routing information: O(log N) nodes </li></ul></li></ul> <ul><li><ul><li>Lookup: O(log N) nodes </li></ul></li></ul> <ul><li><ul><li>Update: O(log 2N) messages </li></ul></li></ul> <ul><li>It also adapts dynamically to the topology changes introduced during the run </li></ul> <p>32. Future Work </p> <ul><li>Using Chord to detect and heal partitions whose nodes know of each other. </li></ul> <ul><li><ul><li>Every node should know of some same set of initial nodes </li></ul></li></ul> <ul><li><ul><li>Nodes should maintain long-term memory of a random set of nodes that they have visited earlier </li></ul></li></ul> <ul><li>Malicious set of Chord participants could present an incorrect view of the Chord ring </li></ul> <ul><li><ul><li>Node n periodically asks other nodes to do a lookup for n </li></ul></li></ul> <p>33. </p> <ul><li>THANK YOU </li></ul>

Recommended

View more >