Docsity

Understanding Distributed Hash Tables: A Comparison of Chord and CAN, Study notes of Software Engineering

Partial preview of the text

Download Understanding Distributed Hash Tables: A Comparison of Chord and CAN and more Study notes Software Engineering in PDF only on Docsity!

Distributed Software Development

More DHTs^ Chris BrooksDepartment of Computer ScienceUniversity of San Francisco

Department of Computer Science — University of San Francisco – p. 1/

16-2: Distributed Hash Tables^ •^ On Tuesday, we talked about Distributed Hash Tables^ ◦

Used Chord as an example • Able to act as a distributed storage and indexing mechanism • Maps “keys” (hashes of data) to “values” (coordinates in aspace of nodes.) • Each node is responsible for a set of the keyspace.

Department of Computer Science — University of San Francisco – p. 2/

16-4: Chord^ •^ Recall that Chord uses a 1-D ring to structure the network.^ •^ Nodes keep a

finger table

that tells them the successors at

various points in the network. • Routing requires

O(logn

)^ messages.

-^ Can tolerate failures through replication of data.

Department of Computer Science — University of San Francisco – p. 4/

16-5: CAN^ •^ CAN stands for Content Addressable Network^ •^ Developed at Berkeley at the same time as Chord wasdeveloped at MIT.^ •^ Also provides hash-table like functionality.^ ◦

get, store, delete

Department of Computer Science — University of San Francisco – p. 5/

16-7: Example^0 0 ,

-^ An example CAN in a 2-Dspace. •^ Node 1 is responsible fordata in the range ( (0-0.25),(0.5-1) ) •^ Node

4 is

responsible

for

data in the range ( (0.5-1),(0.5-1) )

Department of Computer Science — University of San Francisco – p. 7/

16-8: Routing in CAN^ •^ Each node keeps track of the IP address and zone of itsneighbors.^ •^ A neighbor is a node whose zone overlaps a node in

n^ −^1

dimensions, and abuts it in the

nth dimension.

-^ In our example, 2,3, and 4 are neighbors of 1.^ ◦^

Remember that the space is really a torus.

-^ Routing is done by greedy search. •^ Always forward the message to the neighbor who is closest tothe data, using standard Euclidean distance. (ties brokenrandomly)

Department of Computer Science — University of San Francisco – p. 8/

16-10: Node joining^ •^ New nodes are added to the system by choosing an existingzone and subdividing it.^ •^ First, the new node must find an existing bootstrap node.^ •^ Then it must find its coordinates within CAN^ •^ Finally, it must update its neighbors’ routing tables.

Department of Computer Science — University of San Francisco – p. 10/

16-11: Node joining - bootstrapping^ •^ It is assumed that the IP address of at least one current CANnode is known to the joining node.^ •^ The designers use DNS to map a CAN hostname to one ormore CAN nodes.^ •^ This bootstrap node can provide the IP addresses of othernodes in the network that can be used as entry points.

Department of Computer Science — University of San Francisco – p. 11/

16-13: Node joining - updating neighbors^ •^ Once the zone has been partitioned, all neighbors need toupdate their routing tables.^ •^ New node gets the routing table from the node whose zone itsplit.^ •^ Adds node whose zone it split, and removes all non-neighbors.^ •^ Split node removes non-neighbors as well.^ •^ Both nodes send update messages to all affected nodes.

Department of Computer Science — University of San Francisco – p. 13/

16-14: Example^0 0 ,

-^ Initially, 3’s neighbors are1,2 and 5. •^ 6 joins and splits 3’s zonealong the x axis. •^ 6 gets 3’s list ofneighghbors •^ 6 adds 3 to its neighbor listand sends an update to 1,2,and 5 •^ 3 adds 6 to its list ofneighbors •^ 3 removes 1 and 2 from itslist of neighbors and sendsthem an update.

Department of Computer Science — University of San Francisco – p. 14/

16-16: Handling Failure^ •^ CAN nodes send periodic “I’m alive” messages to theirneighbors^ ◦

Contains a node’s zone coordinates and their neighbors andtheir coordinates. • If a node does not receibe an “I’m alive” message after a giventime period, it begins a takeover. • To begin, it starts a timer ◦ Length is proportionate to its zone size. ◦ Intuition: we want to merge smaller zones • Once the timer expires, send a TAKEOVER message to all ofthe failed node’s neighbors. • When a TAKEOVER message is received, a node turns off itsown timer if the zone volume of the sender is less than its own. • Otherwise, it replies with its own TAKEOVER message. ◦ Somewhat like leader election.

Department of Computer Science — University of San Francisco – p. 16/

16-17: Latency^ •^ A weakness of CAN (and Chord) is that message routinghappens at the

application level

rather than at the IP level.

-^ No guarantees that nodes near each other in the CAN networkare actually near each other in the underlying network. •^ This can lead to long delays in practice, even if the number ofapplication-level hops is small •^ Goal: achieve latency close to that of the underlying IPlatencies.

Department of Computer Science — University of San Francisco – p. 17/

16-19: Improved routing metrics^ •^ The basic CAN routing algorithm uses greedy search. Itchooses the node that produces the greatest reduction indistance between the present node and the data to be found.^ •^ An alternative is to also measure the round-trip-time between anode and each of its neighbors.^ •^ When choosing where to forward a packet, select the node thatmaximizes progress over RTT.^ •^ This favors low-latency paths at the IP level.

Department of Computer Science — University of San Francisco – p. 19/

16-20: Overloading zones^ •^ The basic design assumes that each zone is assigned toexactly one node.^ •^ Alternatively, multiple peers can share zones.^ •^ Each peer maintains a list of other peers in its zone, in additionto the neighbor list.^ •^ When a node receives an update from a neighbor, he computesthe RTT for each of the nodes in that zone.^ •^ Retains the lowest RTT.^ •^ Contents may be either divided amongst peers or elsereplicated.

Department of Computer Science — University of San Francisco – p. 20/