HOW NODE JOINS OR LEAVE IN PEER
TO PEER NETWORK




Presented by:
Chaitanya Pratap Singh
MCA(4th Semester)
South Asian University, new Delhi.
NODE JOIN (PEER JOIN)
 Joining peer sends a "join" request to the boot
  peer, and gets a GUID back.
 Joining peer sends a "copy routing table" to the
  boot peer.
 Joining peer finds the correct peers it should have
  in its own routing table.
THE JOIN REQUEST
   The first peer to join the network apart from the boot
    peer, will connect to the boot peer and send a "join"
    message. The boot peer responds with a new GUID
    to the joining peer.
THE COPY ROUTING TABLE REQUEST

   After getting a GUID, the joining peer requests to get
    a copy of the boot peers routing table.
FINDING THE CORRECT PEERS FOR THE
ROUTING TABLE
   the joining peer uses this routing table to find the
    peers it should really have in its routing table.
LEAVING NODE
   When a peer no longer wants to be part of a P2P
    network, it will send a "leave" request to all peers in
    its routing table
CONT…
 if A has B in its routing table, B does not necessarily
  have A in its routing table.
 Thus, if A leaves a Chord network, it would have to
  find the peers in the network that has A in its routing
  table.
 In    other words, find those peers which
  have distance(X, A) closest to 20, 21, 22 etc. Once
  those peers are found, the leaving peer (A) will
  send a leave message to each of them.
CHORD STATE AND LOOKUP (1)
   Basic Chord: each                   m=6
    node knows only 2                          2m-1
                                                    N1
    other nodes on the ring                       0
       Successor                  N56                            N8
       Predecessor (for ring     K54
                                                    lookup(K54)
        management)              N51
   Lookup is achieved by
                                                                       N14
    forwarding requests         N48
    around the ring through
    successor pointers
       Requires O(N) hops        N42
                                                                  N21
                                       N38
                                                                   8
                                              N32
CHORD STATE AND LOOKUP (2)                                              Finger table
                                                                         N8+1N14
   Each node knows m                        m=6
                                                                         N8+2N14
                                                                         N8+4N14
    other nodes on the ring                              2m-1            N8+8N21
       Successors: finger i of n                             N1         N8+16
                                                                             N32
                                                            0
        points to node at n+2i (or                                       N8+32
                                                                             N42
        successor)                      N56              lookup(K54)      N8
       Predecessor (for ring          K54                                +1
        management)                   N51                                +2
       O(log N) state per node                                         +4
   Lookup is achieved by            N48                    +16    +8           N14
    following closest                              +32
    preceding fingers, then
    successor
                                       N42
       O(log N) hops                                                     N21
                                            N38
                                                                            9
                                                     N32
JOINING THE RING
   Three step process:
     Initialize all fingers of new node
     Update fingers of existing nodes
     Transfer keys from successor to new node
JOINING THE RING — STEP 1
   Initialize the new node finger table
     Locate any node n in the ring
     Ask n to lookup the peers at j+20, j+21, j+22…
     Use results to populate finger table of j
JOINING THE RING — STEP 2
                                                                 N8+1N14
                                                                 N8+2N14
 Updating fingers of                  m=6                       N8+4N14
 existing nodes                               2m-1               N8+8N21
                                                   N1            N8+16
                                                                     N28
                                                                     N32
                                                 0
   New node j calls                                           6 N8+32
                                                                     N42
                                     N56                         N8
    update function on
    existing nodes that
                                N51                                 12
    must point to j
      Nodes in the ranges     N48                                      N14
                                                   +16     -16
       [j-2i , pred(j)-2i+1]
   O(log N) nodes need
    to be updated                N42
                                                                  N21
                                      N38
                                                         N28       12
                                             N32
JOINING THE RING — STEP 3
     Transfer key responsibility
        Connect to successor
        Copy keys from successor to new node
        Update successor pointer and remove keys

     Only keys in the range are transferred



              N21               N21                 N21                N21


N32                 N32 N28           N32 N28             N32 N28
      K24              K24               K24 K24             K30 K24
      K30              K30               K30
NODE JOIN ALGORITHM
CONT…

Chord Node Join

  • 1.
    HOW NODE JOINSOR LEAVE IN PEER TO PEER NETWORK Presented by: Chaitanya Pratap Singh MCA(4th Semester) South Asian University, new Delhi.
  • 2.
    NODE JOIN (PEERJOIN)  Joining peer sends a "join" request to the boot peer, and gets a GUID back.  Joining peer sends a "copy routing table" to the boot peer.  Joining peer finds the correct peers it should have in its own routing table.
  • 3.
    THE JOIN REQUEST  The first peer to join the network apart from the boot peer, will connect to the boot peer and send a "join" message. The boot peer responds with a new GUID to the joining peer.
  • 4.
    THE COPY ROUTINGTABLE REQUEST  After getting a GUID, the joining peer requests to get a copy of the boot peers routing table.
  • 5.
    FINDING THE CORRECTPEERS FOR THE ROUTING TABLE  the joining peer uses this routing table to find the peers it should really have in its routing table.
  • 6.
    LEAVING NODE  When a peer no longer wants to be part of a P2P network, it will send a "leave" request to all peers in its routing table
  • 7.
    CONT…  if Ahas B in its routing table, B does not necessarily have A in its routing table.  Thus, if A leaves a Chord network, it would have to find the peers in the network that has A in its routing table.  In other words, find those peers which have distance(X, A) closest to 20, 21, 22 etc. Once those peers are found, the leaving peer (A) will send a leave message to each of them.
  • 8.
    CHORD STATE ANDLOOKUP (1)  Basic Chord: each m=6 node knows only 2 2m-1 N1 other nodes on the ring 0  Successor N56 N8  Predecessor (for ring K54 lookup(K54) management) N51  Lookup is achieved by N14 forwarding requests N48 around the ring through successor pointers  Requires O(N) hops N42 N21 N38 8 N32
  • 9.
    CHORD STATE ANDLOOKUP (2) Finger table N8+1N14  Each node knows m m=6 N8+2N14 N8+4N14 other nodes on the ring 2m-1 N8+8N21  Successors: finger i of n N1 N8+16 N32 0 points to node at n+2i (or N8+32 N42 successor) N56 lookup(K54) N8  Predecessor (for ring K54 +1 management) N51 +2  O(log N) state per node +4  Lookup is achieved by N48 +16 +8 N14 following closest +32 preceding fingers, then successor N42  O(log N) hops N21 N38 9 N32
  • 10.
    JOINING THE RING  Three step process:  Initialize all fingers of new node  Update fingers of existing nodes  Transfer keys from successor to new node
  • 11.
    JOINING THE RING— STEP 1  Initialize the new node finger table  Locate any node n in the ring  Ask n to lookup the peers at j+20, j+21, j+22…  Use results to populate finger table of j
  • 12.
    JOINING THE RING— STEP 2 N8+1N14 N8+2N14  Updating fingers of m=6 N8+4N14 existing nodes 2m-1 N8+8N21 N1 N8+16 N28 N32 0  New node j calls 6 N8+32 N42 N56 N8 update function on existing nodes that N51 12 must point to j  Nodes in the ranges N48 N14 +16 -16 [j-2i , pred(j)-2i+1]  O(log N) nodes need to be updated N42 N21 N38 N28 12 N32
  • 13.
    JOINING THE RING— STEP 3  Transfer key responsibility  Connect to successor  Copy keys from successor to new node  Update successor pointer and remove keys  Only keys in the range are transferred N21 N21 N21 N21 N32 N32 N28 N32 N28 N32 N28 K24 K24 K24 K24 K30 K24 K30 K30 K30
  • 14.
  • 15.