This episode digs into the peer-to-peer software architecture pattern. It is common among file-sharing and crypto networks. Likewise, the pattern is not too complicated. However, it is robust and secure as we have tightly defined communication paths. We also have every node playing the role of both client and server.
The Peer-To-Peer Pattern DefinedThe description of peer-to-peer is even less complex than client-server. We have two nodes with a bi-directional link between them. Each node can serve as a client or as a server. Therefore, we also see this at times when we want to keep two machines synchronized for load balance and fail-over purposes. The network can expand to any number of nodes. However, each node connects to another as both a client and a server, so direct communication is always available.
On The Same Page While there are many benefits for a peer-to-peer network, the primary focus is keeping each node current with data. That data may be a file, a list of transactions, or even authorization lists. Any given node may interact with numerous other nodes, but those interactions will always go both ways. Thus, an update on node A may be broadcast to nodes B through Z, and then an update on Z may go out to A through Y. Challenges The goal of peer-to-peer is to keep things synchronized. That means we want to update the other nodes when we have a change request. The work required to do those updates can flood the network and need to be managed. An old example is early network games like Doom that sent out too many updates to the network. You could crash the network as timeouts ran rampant across the nodes, and they tried to resend that data. There are patterns for doing such notifications that we will discuss at a later date.