07 Chord中的高级问题

展开查看详情

1. Chord Advanced issues

2. Analysis Theorem. Search takes O (log N) time (Note that in general, when there are m fingers, 2m may be much larger than N) Proof. After log N forwarding steps, distance to key is at most 2 m / N (N= 2 log N). Number of nodes in the remaining range is O (log N) with high probability (this is property of consistent hashing). So by using successors in that range, it will take at most an additional O (log N) forwarding steps.

3. Analysis (contd.) O(log N) search time is true if finger and successor entries correct. But what if these entries are wrong (which is possible during join or leave operations, or process crash?

4. Search under peer failures N32 crashed. Lookup for K42 fails (N16 does not know N45) Say m=7 0 N112 N16 N96 X Who has abcnews.com? (hashes to K42) X X N32 N80 N45 File abcnews.com with key K42 stored here

5. Search under peer failures One solution: maintain r multiple successor entries in case of a failure, use other successor entries. Reactive vs. Say m=7 0 Proactive approach N112 N16 N96 Who has abcnews.com? X N32 (hashes to K42) N80 N45 File abcnews.com with key K42 stored here

6. Search under peer failures Choosing r=2log(N) suffices to maintain the correctness “with high probability.” Say 50% of nodes fail (i.e prob of failure = ½). For a given node, Probability (at least one successor alive) = 1 1 1 −( ) 2 log N =1 − 2 2 N

7. Search under peer failures (2) Lookup fails (N45 is dead) Say m=7 0 N112 N16 N96 Who has abcnews.com? N32 (hashes to K42) X N80 X N45 File abcnews.com with key K42 stored here

8. Search under peer failures (2) One solution: replicate file/key at r successors and predecessors Say m=7 0 N112 N16 N96 Who has abcnews.com? N32 (hashes to K42) K42 replicated N80 X N45 File abcnews.com with K42 replicated key K42 stored here

9.Dealing with dynamic issues Peers fail New peers join Peers leave Need to update successors and fingers, and ensure keys reside in the right places

10. New peers joining Some gateway node directs N40 to its successor N45 N32 updates successor to N40 N40 initializes successor to N45, and obtains fingers from it N40 periodically talks to neighbors to update finger table Say m=7 0 Stabilization N112 N16 protocol N96 Gateway node N32 N40 N80 N45 New node

11. New peers joining (2) N40 may need to copy some files/keys from N45 (files with fileid between 32 and 40) Say m=7 0 N112 N16 N96 N32 N40 N80 N45 K34,K38

12. Concurrent join 0 N112 N16 Say m=7 N20 N96 N24 N28 N32 K24 N80 N45 K38 Argue that each node will eventually be reachable

13. Effect of join on lookup If in a stable network with N nodes, another set of N nodes joins the network, and the join protocol correctly sets their successors, then lookups will take O(log N) steps w.h.p

14.Effect of join on lookup Consistent hashing guarantees that there be O(log N) new nodes 0 w.h.p between two N112 N16 consecutive nodes N20 Transfer pending N96 Linear Scan N24 Will locate K24 N28 N32 K24 N80 N45 K38

15.Weak and Strong Stabilization N1 Loopy network N3 N96 N5 N78 N24 N63 For all u: (successor (predecessor (u))) = u. Still it is weakly stable but not strongly stable. Why?

16. Loopy network N1 N3 (succ (pred (u))) = u N96 N5 stable N78 N24 Must be false for strong stability N63 What is funny / awkward about this? There is a v: u < v < successor (u) (Weakly stable)

17. Strong stabilization The key idea of recovery from loopiness is: Let each node u ask its successor to walk around the ring until it reaches a node v : u <v ≤ successor(u). If There exists a v: u <v < successor(u) then loopiness exists, and reset successor(u):=v Takes O(N2) steps. But loopiness is a rare event. No protocol for recovery exists from a split ring.

18. New peers joining (3) • A new peer affects O(log N) other finger entries in the system. So, the number of messages per peer join= O(log(N)*log(N)) • Similar set of operations for dealing with peers leaving

19. Bidirectional Chord Each node u has fingers to u+1, u+2, u+4, u+8 … as well as u-1, u-2, u-4, u-8 … How does it help?

20. Cost Cost of of lookup lookup  Cost is O(Log N) as predicted by theory  constant is 1/2 Average Messages per Lookup Number of Nodes

21. Robustness Robustness  Simulation results: static scenario Failed lookup means original node with key failed (no replica of keys)  Result implies good balance of keys among nodes!

22. Strengths Strengths  Consistent hashing guarantees balance  Proven performance in many different aspects  “with high probability” proofs  Good tolerance to random node failures

23. Weakness Weakness  Network proximity not addressed  Protocol security  Malicious data insertion  Malicious Chord table information  Keyword search