1 / 11

110 likes | 358 Views

Peer-to-Peer Distributed Search. Peer-to-Peer Networks. A pure peer-to-peer network is a collection of nodes or peers that: Are autonomous: participants do not respect any central control and can join or leave the network at will.

Download Presentation
## Peer-to-Peer Distributed Search

**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

**Peer-to-Peer Networks**A pure peer-to-peer network is a collection of nodes or peers that: • Are autonomous: participants do not respect any central control and can join or leave the network at will. • Are loosely coupled; they communicate over a general-purpose network such as the Internet, rather than being hard-wired together like the processors in a parallel machine. • Are equal in functionality; there is no leader or controlling node. • Share resources with one another. Examples: Napster, Kazaa, BitTorrent, …**Challenge: Search**• Lookup records in a (very large) set of key-value pairs. • Associated with each key Kis a value V. • E.g. • Kmight be the identifier of a document. • Vcould be the document itself. • If the size of the key-value data is small, we could use a central node that holds the entire key-value table. • All nodes would query the central node when they wanted the value Vassociated with a given key K.**What if the table is too large?**Solution: Distribute the responsibility What we want: • The value of Vshould be obtained using few messages.**Chord Circles - Placement**• To place a node in the circle, we hash its ID i, and place it at position h(i). • Key-value pairs are also distributed around the circle using hash function h. • For a pair (K, V )compute h(K)and place (K, V )at the lowest numbered node Njsuch that h(K) j. • In Fig. • Any (K, V )pair such that 42 < h(K) 48 would be stored at N48. • If h(K)is any of 57,58,. .. ,63,0,1, then (K, V )would be placed at N1.**(Inefficient) Search**Assumption • Each node knows its successor in the circle. Search • For instance, if N8 wants to find V for key Ksuch that h(K)= 54, it can send the request forward around the circle until a node Njis found such that j 54; • it would be node N56. • Very inefficient!**Links in Chord Circles**• To speed up the search, each node has a finger table • Gives the first nodes found at distances around the circle that are a power of two. • Suppose that the hash function hproduces m-bit numbers. • Node Nihas entries in its finger table for distances 1,2,4,8, . . . ,2m-1. • The entry for 2jis the first node we meet after going distance 2jclockwise around the circle. Example: Finger table for N8 is**Search Using Finger Tables**• Suppose Niwants to find (K, V )where h(K)= j. • If (K, V ) exists, it will be at the lowest-numbered node that is at least j. Algorithm Idea • Let Nk be the successor of Ni. • Check if i<jk. If yes, (K, V ) must be at Nk if it exists. So, end the search and ask Nk to send (K, V ). • Otherwise, consult the finger table to find the highest-numbered node Nhthat is less than j. • Send Nha message asking it to search for (K, V ). • Nhbehaves the same.**Search Using Finger Tables: Example**• Suppose N8 wants to find (K, V ), where h(K)= 54. • Since the successor of N8 is N14, and 54{9,10,…,14}, (K, V)is not at N14. • N8 examines its finger table, and finds that all the entries are below 54. • Thus it takes the largest, N42, and sends a message to N42asking it to look for key K and have the result sent to N8. • N42finds that 54{43,44,…,48} between N42and its successor N48. • Thus, N42examines its own finger table, which is:**Search Using Finger Tables: Example**• The last node (in the circular sense) that is less than 54 is N51, so N42sends a message to N51, asking it to search for (K, V )on behalf of N8. • N51finds that 54 is no greater than its successor, N56. So, if (K,V )exists, it is at N56. • N51sends a request to N56, which replies to N8. The sequence of messages is shown in Fig.**Adding New Nodes**• A new node Ni(i.e., a node whose ID hashes to i) wants to join. • If Nidoesn’t know any peer, it is not possible for itto join. • However, if Niknows even one peer, Nican askthat peer what node would be Ni's successor around the circle. • To answer, the known peer performs the algorithm asif it were looking for a key that hashed to i. • The node at which this hypothetical key would reside is the successor of Ni. Suppose that the successor of Niis Nj. We need to do two things: • Change predecessor and successor links, so Niis properly linked into the circle. • Rearrange data so Nigets all the data at Njthat belongs to Ni. To avoid concurrency problems, we follow a procedure we will not cover here.

More Related