1 / 23

Chord

Chord. (slides by Nick Feamster). Chord: Overview. What is Chord? A scalable, distributed “lookup service” Lookup service: A service that maps keys to nodes Key technology: Consistent hashing Major benefits of Chord over other lookup services Provable correctness Provable “performance”.

jonathann
Télécharger la présentation

Chord

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. Chord (slides by Nick Feamster)

  2. Chord: Overview • What is Chord? • A scalable, distributed “lookup service” • Lookup service:A service that maps keys to nodes • Key technology:Consistent hashing • Major benefits of Chord over other lookup services • Provable correctness • Provable “performance”

  3. N1 N2 N3 N5 N4 Chord: Primary Motivation Scalable location of data in a large distributed system Publisher Key=“LetItBe” Value=MP3 file Client Lookup(“LetItBe”) Key Problem: Lookup

  4. Chord: Design Goals • Load balance: Chord acts as a distributed hash function, spreading keys evenly over the nodes. • Decentralization: Chord is fully distributed: no node is more important than any other. • Scalability: The cost of a Chord lookup grows as the log of the number of nodes, so even very large systems are feasible. • Availability: Chord automatically adjusts its internal tables to reflect newly joined nodes as well as node failures, ensuring that, the node responsible for a key can always be found.

  5. Hashing • Hashing: assigns “values” to “buckets” • In our case the bucket is the node, the value is the file • key = f(value) mod N, where N is the number of buckets • place value in the key-th bucket • Achieves load balance if values are randomly distributed under f • Consistent Hashing: assign values such that addition or removal of buckets does not modify all values to buckets assignments • Chord challenges • How to perform hashing in a distributed fashion? • What happens when nodes join and leave? Consistent hashing addresses these problems

  6. Consistent Hashing • Main idea: • map both keys and nodes to the same (metric) identifier space • find a “rule” how to assign keys to nodes Ring is one option.

  7. Consistent Hashing • The consistent hash function assigns each node and key an m-bit identifier using SHA-1 as a base hash function • Node identifier: SHA-1 hash of IP address • Key identifier: SHA-1 hash of key

  8. SHA-1 ID=60 Key=“LetItBe” SHA-1 ID=123 IP=“198.10.10.1” Chord Identifiers • m bit identifier space for both keys and nodes • Key identifier: SHA-1(key) • Node identifier: SHA-1(IP address) • How to map key IDs to node IDs?

  9. Consistent Hashing in Chord Rule: A key is stored at its successor: node with next higher or equal ID 0 K5 IP=“198.10.10.1” N123 K20 Circular 7-bit ID space K101 N32 Key=“LetItBe” N90 K60

  10. Consistent Hashing Properties • Load balance: all nodes receive roughly the same number of keys • For N nodes and K keys, with high probability • each node holds at most (1+)K/N keys

  11. Lookups in Chord • Every node knows of every other node • requires global information • Routing tables are large: O(N) • Lookups are fast: O(1) 0 N10 Where is “LetItBe”? Hash(“LetItBe”) = K60 N123 N32 “N90 has K60” K60 N90 N55

  12. Lookups in Chord • Every node knows its successor in the ring • Requires O(N) lookups 0 N10 Where is “LetItBe”? N123 Hash(“LetItBe”) = K60 N32 “N90 has K60” N55 K60 N90

  13. Reducing Lookups: Finger Tables • Each node knows m other nodes in the ring (it has m fingers) • Increase distance exponentially • Finger i points to successor of n+2i-1 i=1..m N120 N16 N112 80 + 25 80 + 26 N96 80 + 24 80 + 23 80 + 22 80 + 21 80 + 20 N80

  14. N32 finger table F0 points to successor(32+20) = 60 F1 points to successor(32+21) = 60 F2 points to successor(32+22) = 60 F3 points to successor(32+23) = 60 F4 points to successor(32+24) = 60 F5 points to successor(32+25) = 80 F6 points to successor(32+26) = 99 Faster Lookups • Lookups are O(log N) hops N5 N14 N110 K19 N20 N99 N32 Lookup(K19) Look for a node identifier in the finger table that is less then the key identifier and closest in the ID space to the key identifier N80 N60

  15. Summary of Performance Results • Efficient:O(log N) messages per lookup • Scalable:O(log N) state per node • Robust: survives massive membership changes

  16. Joining the Ring • Three step process • Initialize all fingers of new node • Update fingers of existing nodes • Transfer keys from successor to new node • Two invariants to maintain • Each node’s successor is correctly maintained • successor(k) is responsible for k

  17. Join: Initialize New Node’s Finger Table • Locate any node p in the ring • Ask node p to lookup fingers of new node N5 N20 N99 N36 1. Lookup(37,38,40,…,100,164) N40 N80 N60

  18. Join: Update Fingers of Existing Nodes • New node calls update function on existing nodes n becomes the ith fingerprint of node p if p precedes n by at least 2i-1 and ith finger of node p succeeds n. Update in O(log2N) N5 N20 N99 N36 N40 N80 N60

  19. K30 K38 Join: Transfer Keys • Only keys in the range are transferred N5 N20 N99 N36 Copy keys 21..36 from N40 to N36 N40 K30 K38 N80 N60

  20. Handling Failures • Problem: Failures could cause incorrect lookup • Solution:Fallback: keep track of a list of immediate successors N120 N10 N102 Lookup(85) N85 N80

  21. Handling Failures • Use successor list • Each node knows r immediate successors • After failure, will know first live successor • Correct successors guarantee correct lookups • Guarantee with some probability • Can choose r to make probability of lookup failure arbitrarily small

  22. Joining/Leaving overhead • When a node joins (or leaves) the network, only a fraction of the keys are moved to a different location. • For N nodes and K keys, with high probability • when node N+1 joins or leaves, O(K/N) keys change hands, and only to/from node N+1

  23. Structured vs. Unstructured Overlays • Structured overlays have provable properties • Guarantees on storage, lookup, performance • Maintaining structure under churn has proven to be difficult • Lots of state that needs to be maintained when conditions change • Deployed overlays are typically unstructured

More Related