25
DISTRIBUTED SYSTEM Presentation 1 By: Hitesh Chheda 2/2/2010

Presentation 1 By: Hitesh Chheda 2/2/2010. Ion Stoica, Robert Morris, David Karger, M. Frans Kaashoek, Hari Balakrishnan MIT Laboratory for Computer Science

Embed Size (px)

Citation preview

Page 1: Presentation 1 By: Hitesh Chheda 2/2/2010. Ion Stoica, Robert Morris, David Karger, M. Frans Kaashoek, Hari Balakrishnan MIT Laboratory for Computer Science

DISTRIBUTED SYSTEM

Presentation 1By: Hitesh Chheda

2/2/2010

Page 2: Presentation 1 By: Hitesh Chheda 2/2/2010. Ion Stoica, Robert Morris, David Karger, M. Frans Kaashoek, Hari Balakrishnan MIT Laboratory for Computer Science

CHORD: A SCALABLE PEER-TO-PEER

LOOKUP SERVICE FOR INTERNET

APPLICATIONS

Ion Stoica, Robert Morris, David Karger, M. Frans Kaashoek, Hari BalakrishnanMIT Laboratory for Computer Science

Page 3: Presentation 1 By: Hitesh Chheda 2/2/2010. Ion Stoica, Robert Morris, David Karger, M. Frans Kaashoek, Hari Balakrishnan MIT Laboratory for Computer Science

Abstract

A fundamental problem that confronts peer-to peer applications is to efficiently locate the node that stores a particular data item. This paper presents Chord, a distributed lookup protocol that addresses this problem. Chord provides support for just one operation: given a key, it maps the key onto a node.

Page 4: Presentation 1 By: Hitesh Chheda 2/2/2010. Ion Stoica, Robert Morris, David Karger, M. Frans Kaashoek, Hari Balakrishnan MIT Laboratory for Computer Science

Data location can be easily implemented on top of Chord by associating a key with each data item, and storing the key/data item pair at the node to which the key maps. Chord adapts efficiently as nodes join and leave the system, and can answer queries even if the system is continuously changing. Results from theoretical analysis, simulations, and experiments show that Chord is scalable.

Page 5: Presentation 1 By: Hitesh Chheda 2/2/2010. Ion Stoica, Robert Morris, David Karger, M. Frans Kaashoek, Hari Balakrishnan MIT Laboratory for Computer Science

Introduction

Peer-to-peer systems and applications are distributed systems without any centralized control.

The Chord protocol supports just one operation: given a key, it maps the key onto a node. Chord uses a variant of consistent hashing to assign keys to Chord nodes.

Page 6: Presentation 1 By: Hitesh Chheda 2/2/2010. Ion Stoica, Robert Morris, David Karger, M. Frans Kaashoek, Hari Balakrishnan MIT Laboratory for Computer Science

In an steady state, in an N-node system, each node maintains information only about O(log N) other nodes, and resolves all loop-up via O(log N) messages to other nodes. Chord maintains its routing information as nodes join and leave the system; with high probability each such event results in no more than O(log2 N) messages

Three features that distinguish Chord from many other peer-to-peer lookup protocols are its simplicity, provable correctness, and provable performance.

Page 7: Presentation 1 By: Hitesh Chheda 2/2/2010. Ion Stoica, Robert Morris, David Karger, M. Frans Kaashoek, Hari Balakrishnan MIT Laboratory for Computer Science

Related Work

While Chord maps keys onto nodes, traditional name and location services provide a direct mapping between keys and values. A value can be an address, a document, or an arbitrary data item.

E.g DNS (compare) Other systems – Freenet, Ohaha, Globe,

Plaxton, CAN.

Page 8: Presentation 1 By: Hitesh Chheda 2/2/2010. Ion Stoica, Robert Morris, David Karger, M. Frans Kaashoek, Hari Balakrishnan MIT Laboratory for Computer Science

System Model

Chord address these difficulty problems: Load balance Decentralization Scalability Availability Flexible naming

Page 9: Presentation 1 By: Hitesh Chheda 2/2/2010. Ion Stoica, Robert Morris, David Karger, M. Frans Kaashoek, Hari Balakrishnan MIT Laboratory for Computer Science

Following are examples of applications for which Chord would provide a good foundation:

1. Cooperative Mirroring2. Time-Shared Storage3. Distributed Indexes4. Large-Scale Combinatorial Search

Page 10: Presentation 1 By: Hitesh Chheda 2/2/2010. Ion Stoica, Robert Morris, David Karger, M. Frans Kaashoek, Hari Balakrishnan MIT Laboratory for Computer Science

The Base Chord Protocol

1. Consistent Hashing The consistent hash function assigns

each node and key an m-bit identifier using a base hash function such as SHA-1 [9]. A node’s identifier is chosen by hashing the node’s IP address, while a key identifier is produced by hashing the key.

Page 11: Presentation 1 By: Hitesh Chheda 2/2/2010. Ion Stoica, Robert Morris, David Karger, M. Frans Kaashoek, Hari Balakrishnan MIT Laboratory for Computer Science

Consistent hashing assigns keys to nodes as follows. Identifiers are ordered in an identifier circle modulo 2m. Key k is assigned to the first node whose identifier is equal to or follows (the identifier of) k in the identifier space. This node is called the successor node of key k denoted by successor(k). If identifiers are represented as a circle of numbers from 0 to 2m – 1, then successor(k) is first node clockwise from k.

Page 12: Presentation 1 By: Hitesh Chheda 2/2/2010. Ion Stoica, Robert Morris, David Karger, M. Frans Kaashoek, Hari Balakrishnan MIT Laboratory for Computer Science

An identifier circle consisting of the three nodes 0, 1, and 3. In this example, key 1 is located at node 1, key 2 at node 3, and key 6 at node 0.

Page 13: Presentation 1 By: Hitesh Chheda 2/2/2010. Ion Stoica, Robert Morris, David Karger, M. Frans Kaashoek, Hari Balakrishnan MIT Laboratory for Computer Science

2. Scalable Key Location A very small amount of routing information

suffices to implement consistent hashing in a distributed environment. Each node need only be aware of its successor node on the circle.

A portion of the Chord protocol maintains these successor pointers, thus ensuring that all lookups are resolved correctly.

Let m be the number of bits in the key/node identifiers. Each node, n, maintains a routing table with (at most) m entries, called finger table.

Page 14: Presentation 1 By: Hitesh Chheda 2/2/2010. Ion Stoica, Robert Morris, David Karger, M. Frans Kaashoek, Hari Balakrishnan MIT Laboratory for Computer Science

The ith entry in the table at node n contains the identity of the first node, s, that succeeds n by atleast 2i-1 on identifier circle.

Page 15: Presentation 1 By: Hitesh Chheda 2/2/2010. Ion Stoica, Robert Morris, David Karger, M. Frans Kaashoek, Hari Balakrishnan MIT Laboratory for Computer Science

(a)The finger intervals associated with node 1. (b)(b) Finger tables and key locations for a net with

nodes 0, 1, and 3, and keys 1, 2, and 6.

Page 16: Presentation 1 By: Hitesh Chheda 2/2/2010. Ion Stoica, Robert Morris, David Karger, M. Frans Kaashoek, Hari Balakrishnan MIT Laboratory for Computer Science

3. Node JoinsChord needs to preserve two invariants:1. Each node’s successor is correctly

maintained.2. For every key k, node successor(k) is

responsible for k.

Page 17: Presentation 1 By: Hitesh Chheda 2/2/2010. Ion Stoica, Robert Morris, David Karger, M. Frans Kaashoek, Hari Balakrishnan MIT Laboratory for Computer Science
Page 18: Presentation 1 By: Hitesh Chheda 2/2/2010. Ion Stoica, Robert Morris, David Karger, M. Frans Kaashoek, Hari Balakrishnan MIT Laboratory for Computer Science

Chord must perform three steps when node n joins:

1. Initialize the predecessor and fingers of node n.

2. Update the fingers and predecessors of existing nodes to reflect the addition of n.

3. Notify the higher layer software so that it can transfer state (e.g. values) associated with keys that node n is now responsible for.

Page 19: Presentation 1 By: Hitesh Chheda 2/2/2010. Ion Stoica, Robert Morris, David Karger, M. Frans Kaashoek, Hari Balakrishnan MIT Laboratory for Computer Science

(a)Finger tables and key locations after node 6 joins. (b)Finger tables and key locations after node 3 leaves.

Changed entries are shown in black, and unchanged in gray.

Page 20: Presentation 1 By: Hitesh Chheda 2/2/2010. Ion Stoica, Robert Morris, David Karger, M. Frans Kaashoek, Hari Balakrishnan MIT Laboratory for Computer Science

Concurrent Operations and Failures

1. Stabilization If joining nodes have affected some

region of the Chord ring, a lookup that occurs before stabilization has finished can exhibit one of three behaviors. The common case is that all the finger table entries involved in the lookup are reasonably current, and the lookup finds the correct successor in O(log n) steps.

Page 21: Presentation 1 By: Hitesh Chheda 2/2/2010. Ion Stoica, Robert Morris, David Karger, M. Frans Kaashoek, Hari Balakrishnan MIT Laboratory for Computer Science

The second case is where successor pointers are correct, but fingers are inaccurate.

The higher-layer software using Chord will notice that the desired data was not found, and has the option of retrying the lookup after a pause. This pause can be short, since stabilization fixes successor pointers quickly.

Page 22: Presentation 1 By: Hitesh Chheda 2/2/2010. Ion Stoica, Robert Morris, David Karger, M. Frans Kaashoek, Hari Balakrishnan MIT Laboratory for Computer Science

2. Failures and Replication When a node n, fails, nodes whose finger

tables include n must find n’s successors. After a node failure, but before

stabilization has completed, other nodes may attempt to send requests through the failed node as part of a find successor lookup. Ideally the lookups would be able to proceed, after a timeout, by another path despite the failure.

Page 23: Presentation 1 By: Hitesh Chheda 2/2/2010. Ion Stoica, Robert Morris, David Karger, M. Frans Kaashoek, Hari Balakrishnan MIT Laboratory for Computer Science

Simulation and Experimental Results

1. Protocol Simulator The Chord protocol can be implemented

in an iterative or recursive style.2. Load Balance In a network with N nodes and K keys, we

would like the distribution of keys to nodes to be tight around N/K.

3. Path Length The path length is defined as the number

of nodes traversed during a lookup operation.

Page 24: Presentation 1 By: Hitesh Chheda 2/2/2010. Ion Stoica, Robert Morris, David Karger, M. Frans Kaashoek, Hari Balakrishnan MIT Laboratory for Computer Science

4. Simultaneous Node Failures After the failures occur, we wait for the

network to finish stabilizing, and then measure the fraction of keys that could not be looked up correctly. A correct lookup of a key is one that finds the node that was originally responsible for the key, before the failures; this corresponds to a system that stores values with keys but does not replicate the values or recover them after failures.

Page 25: Presentation 1 By: Hitesh Chheda 2/2/2010. Ion Stoica, Robert Morris, David Karger, M. Frans Kaashoek, Hari Balakrishnan MIT Laboratory for Computer Science

Conclusion

Many distributed peer-to-peer applications need to determine the node that stores a data item. The Chord protocol solves this challenging problem in decentralized manner. It offers a powerful primitive: given a key, it determines the node responsible for storing the key’s value, and does so efficiently. In the steady state, in an N node network, each node maintains routing information for only about O(log N) other nodes, and resolves all lookups via O(log N) messages to other nodes. Updates to the routing information for nodes leaving and joining require only O(log2 N) messages.

QUESTIONS…