P2P - Chord Network Overview


SUBMITTED BY: Guest

DATE: Dec. 12, 2013, 2:17 p.m.

FORMAT: Text only

SIZE: 3.1 kB

HITS: 830

  1. Its a bunch of nodes that all have (semi-random) (numeric) IDs and they want to connect in such a way to minimize searching.
  2. Therefore, each node connects to at least sqrt(network_size) nodes but no more than there are bits in the address space.
  3. For example, if you had a limit of 8 nodes, your address space would have 3 bits. This measns that each node would only connect to up to 3 nodes.
  4. Imagine 8 nodes are in the network, with IDs 0-7. They are logically laid out like so:
  5. 0 1
  6. 7 2
  7. 6 3
  8. 5 4
  9. Node 0 only wants to connect to 3 nodes, 1, 2, and 4.
  10. 0---1
  11. 7 \ \--2
  12. \
  13. 6 \ 3
  14. 5 4
  15. Node 4 has a similar pattern of connections, except that instead of nodes 1 and 2, it connects to 5 and 6.
  16. It's pretty easy to see how this pattern replicates around the ring.
  17. This also lets us see that if 0 wants to talk to 6, which it is NOT connected to and has no idea of its location, it just needs to talk to node 4 and ask it where 6 is.
  18. 4 has no problem telling 0 where 6 is and now 0 and 6 can talk or exchange data or anything else two nodes might want to do.
  19. For 0 to talk to 7, it's just one more step. 0 asks 4 for 7, 4 doesn't know where 7 is (remember the pattern?), but it knows where 6 is and 6 is closer to 7. So it tells 0 where 6 is.
  20. Now 0 asks 6 where 7 is. 6 knows where 7 is so it tells 0 and we're done.
  21. This also scales up immensely. For the entirety of the IPv4 addressing space, each node need only keep 64 entries. Searching for a node is on the order of O(log N)
  22. When a node joins, it's a slightly more complex process (only slightly).
  23. The new node contacts a super node (or a bootstrap server) and announces itself.
  24. The new node is either provided with an ID by the server or generates its own.
  25. Next, the new node (with its ID) is given a copy of the super node's current table of addresses. It then calculated the "ideal" nodes it should connect to.
  26. Using our example above, if a new node joined and was assigned ID:3, it would calculate that it should connect to 4, 5, and 7.
  27. Now, the network will (likely) never be full. This means that at least occasionally, the node will try to connect to a node that isn't present.
  28. Tons of things can happen when this fails, the most common is to just pick the nearest node without going over the ideal node that it can find. So if 7 isn't present, connect to 6 instead.
  29. Once the new connections have been built, we have our own address table and the super node's is no longer needed and we are fully part of the network.
  30. When a node leaves, all nodes that were connected to it (64 at most) should just apply their searching techniques to find a new node for their ideal position the dead node was filling.
  31. As new nodes join and open connections, it may be needed to replace connections of an existing node that are now filled by a better-fitting node. This just standard network maintaince and keeps the early nodes from being isolated.

comments powered by Disqus