P2P Graph Simulator - Part 2 - Simple P2P

less than 1 minute read

I’ve continued working on the P2P graph simulator and I have added directed connections and a random message delay. I’ve also finished implementing the most basic protocol possible where each peer just connects to as many peers as it can find. The algorithm is very simple. When a new peer connects to the network, it sends a connection request to the node it knows. The receiving node anwers with the list of peers it is connected to. The connecting node in turn sends connection requests to every new peer it received.

Failures are handled by periodically checking each existing connection. If a connection stops working for some reason, a node sends all its peers to its peers and they themselves check if there is a peer to be added back.

Simple P2P

You can see the code in its public repo or try the simulator on its page (hosted by GitHub Pages).

What I’m doing right now is implementing the Ring Network protocol described in this paper.1

  1. (A. Shaker and D. S. Reeves, “Self-stabilizing structured ring topology P2P systems,” Fifth IEEE International Conference on Peer-to-Peer Computing (P2P’05), 2005)