PeertoPeer Distributed Search - PowerPoint PPT Presentation

About This Presentation
Title:

PeertoPeer Distributed Search

Description:

A pure peer-to-peer network is a collection of nodes or peers that: Are autonomous: participants do not ... Examples: Napster, Kazaa, BitTorrent, ... Search ... – PowerPoint PPT presentation

Number of Views:37
Avg rating:3.0/5.0
Slides: 12
Provided by: tho9
Category:

less

Transcript and Presenter's Notes

Title: PeertoPeer Distributed Search


1
Peer-to-Peer Distributed Search
2
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,

3
Search
  • Lookup records in a (very large) set of key-value
    pairs.
  • Associated with each key K is a value V.
  • E.g.
  • K might be the identifier of a document.
  • V could 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 V associated with a given key K.

4
What if the table is too large?
  • Solution Distribute the responsibility
  • At any time, only one node among the peers knows
    the value associated with any given key K.
  • Any node can ask the peers for the value V
    associated with a chosen key K.
  • Desire
  • The value of V should be obtained using few
    messages.

5
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 Nj such that h(K) ?
    j.
  • In Fig.
  • Any (K, V ) pair such that 42 lt
    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.

6
(Inefficient) Search
  • Assumption
  • Each node knows its successor in the circle.
  • Search
  • For instance, if N8 wants to find V for key K
    such that h(K) 54, it can send the request
    forward around the circle until a node Nj is
    found such that j ? 54
  • it would be node N56.
  • Very inefficient!

7
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 h produces m-bit
    numbers.
  • Node Ni has entries in its finger table for
    distances 1,2,4,8, . . . ,2m-1.
  • The entry for 2j is the first node we meet after
    going distance 2j clockwise around the circle.
  • Example Finger table for N8 is

8
Search Using Finger Tables
  • Suppose Ni wants 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 iltj?k. 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 Nh that is less than j.
  • Send Nh a message asking it to search for (K, V
    ).
  • Nh behaves the same.

9
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 N42 asking it to look for key K and
    have the result sent to N8.
  • N42 finds that 54?43,44,,48 between N42 and
    its successor N48.
  • Thus, N42 examines its own finger table, which is

10
Search Using Finger Tables Example
  • The last node (in the circular sense) that is
    less than 54 is N51, so N42 sends a message to
    N51, asking it to search for (K, V ) on behalf of
    N8.
  • N51 finds that 54 is no greater than its
    successor, N56. Thus, if (K,V ) exists, it is at
    N56.
  • N51 sends a request to N56, which replies to N8.
  • The sequence of messages is shown in Fig.

11
Adding New Nodes
  • A new node Ni (i.e., a node whose ID hashes to i)
    wants to join.
  • If Ni doesnt know any peer, it is not possible
    for it to join.
  • However, if Ni knows even one peer, Ni can ask
    that peer what node would be Ni's successor
    around the circle.
  • To answer, the known peer performs the algorithm
    as if 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 Ni is Nj.
  • We need to do two things
  • Change predecessor and successor links, so Ni is
    properly linked into the circle.
  • Rearrange data so Ni gets all the data at Nj that
    belongs to Ni.
  • To avoid concurrency problems, we follow a
    procedure we will not cover here.
Write a Comment
User Comments (0)
About PowerShow.com