Peer to Peer vs Client Server: from Arpanet to blockchain
June 23, 2022
From the birth of the Internet until today, there have been several changes in the concept of computer networks. Among the most established models are those of Client Server and Peer-to-Peer (P2P). Let us therefore discover what P2P and client server architecture are.
What is a network in computer science?
Let’s take a step back: in order to understand the meaning of Peer-to-Peer (P2P) and how the Client Server model works, we must first explore computer networks in general: what are they, and what are the principles behind their functions?
The first computer network in history came from the military. The idea originated in the United States, around the 1960s. At the height of the Cold War, the US government needed to create a system that would guarantee the sharing of information in a secure, fast and reliable manner throughout the country. To this end, Arpanet, the first interconnected computer network, was invented . It has evolved to the point where it has spread, in the civil sphere, under the name we all know today: the Internet.
A computer network connects hardware and software devices to each other by means of communication protocols, which enable the exchange of resources, data or information.
The information technology sector is fast growing. It provides improved solutions based on revolutionary discoveries that will eventually become commonplace. Think of Bitcoin: it gave birth to a new technological era, characterised by rapid innovation and exponential utility. Similarly, various network architectures were built. Here is a list of the main ones:
- LAN (Local Area Network): created for small environments, such as homes or offices. It is usually used to share access to hardware devices, such as printers or scanners, between neighbouring computers;
- MAN (Metropolitan Area Network): used in larger environments, such as a city. Several small interconnected infrastructures are needed to enable a MAN to function;
- Wide Area Network (WAN): network infrastructures must adapt to the growing size of the environment, in order to connect all the devices in the two previous categories. WAN is supra-regional, typically connecting large territories such as nations or entire continents.
- Global Area Network (GAN): a universal network, potentially connecting every other existing LAN, MAN and WAN. The best example of these is the Internet. However some global organisations that connect several localised WANs can build private GANs.
How a computer network works
Now that you understand what a computer network is and the extent to which it can exist, the next step is to understand how it works: how information is exchanged within the network.
Imagine a large city with a square in the middle: 4 friends want to exchange information (a letter for example) and the only way to do this is to transmit it to a common point, the square:
- Each friend represents a computer, called a host (or end system) that sends and receives information from the others;
- The square, called the Node, represents the ‘sorting’ centre for the letters that the four friends exchange.
In our example, the 4 friends have no way of communicating directly with each other, but they are able to do so through the node. So, they are in essence ‘connected’ because they are able to exchange information, but they can never meet in person.
The same thing happens between computers: they use nodes to communicate and exchange information with other devices connected to the network.
Client Server Architecture
In computing, information starts from a device, passes through a node and finally reaches the recipient.
Therefore, along the way, information passes between various devices. They are often organised in a Client and Server architecture:
- Clients: components that access resources or services that are provided by a third party. They can be hardware, such as a smartphone, or software, such as apps.
- Servers: hardware and software components that provide the information required by third parties
Most electronic devices are client devices: each of us most probably own several of them and use them on a daily basis, such as smartphones or messaging applications.
A big difference between a client and a server is that the latter has to handle a huge amount of data and requests simultaneously, so it needs high computing power, a very fast Internet network and a constant supply of electricity.
The meaning of Peer-to-Peer (P2P): advantages and disadvantages
Another type of network architecture, born around the 1970s, is Peer-to-Peer (P2P), based on the protocol of the same name. Let’s find out together what P2P is and how it works, and what differentiates it from client-server architecture.
First of all, the key is in the word “peer” : each individual computer, connected to the network, is both client and server at the same time, handling both requests and responses. They therefore have the same role as every other node in the network. Now that you have a better picture of the concept of P2P, let’s explore the advantages and disadvantages of this type of network compared to client server architecture.
Advantages of P2P:
- Decentralisation: this is the main feature of a Peer-to-Peer network, and it is perfectly applied in blockchain networks. Individual nodes are not organised according to a centralised hierarchy, but rather in a dynamic structure within the virtual network space. There is no central server in total control of the distributed information. This is why, within P2P, each participant stores their own data (server) and requests what they need from the others (clients). In contrast, in the Client Server model, data is stored in a single server: this entails risks of loss, inaccessibility or censorship of information
- Lower costs/Higher scalability: A peer-to-peer network is far cheaper and faster to implement than a client-server architecture. Only a few nodes connected to each other are needed to make P2P operational, and it is just as easy to add new ‘peers’ to the network. The new peers will not have to handle the entire information load, because it is equally distributed in the ecosystem. Instead, the scalability of a server is limited by the resources of the organisation controlling it.
- Redundancy of functions: in theory, single, isolated nodes should be more vulnerable; however, being interchangeable in functions, the network can survive without some peers, finding alternative solutions within the network itself. Imagine if a client-server architecture were deprived of a central node: it would be terribly limited or even unusable.Technically, it is said that in p2p, there is no ‘single point of failure‘ capable of causing an interruption of service.
Disadvantages of P2P:
- Slowness: Given its decentralised nature, the larger and more developed a Peer-to-Peer network is, the slower it will be. This is because each Peer also has unique information and its dissemination will never be as efficient as for a centralised network. Sending data to a ‘distant’ node by passing the information through many other Peers takes time.
- Malware: although encryption exists in the blockchain to protect P2P data transfer, malicious files could be ‘hidden’ among the information being downloaded, potentially spreading throughout the entire network.
- Copyright: as there is no central authority to control, copyrighted files could be illegally distributed. However, in the case of blockchain networks, ownership of online information can be preserved as an NFT, being immutably recorded in a smart contract.
- Offline: if all the nodes of a P2P network were to break their connection to the Internet, the stored data would be unavailable.
P2P Networks: How do they work?
P2P architecture has evolved over time to adapt to new technological requirements, so it has branched out into three network macro-types:
- Pure Peer-to-Peer: completely decentralised, each node in the network has the same hierarchical importance and function.
- Peer-to-Peer with Discovery Server: This Peer-to-Peer model is equipped with one centralised server (Discovery). When a peer enters the network, it communicates its existence to the central server which, in response, returns the complete list of nodes already connected to that network, this will allow it to open communication with all the others.
- Peer-to-Peer with Lookup Server: is an evolution of the Discovery architecture. Nodes communicate, periodically, to all the others what their contents are. Thus, when a node needs to perform a search, it will send the request to the Discovery server which, being aware of the information contained by each peer, will direct it more efficiently.
The future of P2P lies in blockchain
The Internet is a great network in which we all participate. It is a collection of many technologies: the client-server and Peer-to-Peer architectures that we have explored. However, the evolution of network protocols advances in parallel with the emergence of new needs. Peer-to-peer, in particular, has found fertile ground in blockchain services: first with a P2P payment model, then with P2P cloud computing, developed by a series of projects on blockchain that incentivise participation in a large decentralised repository of content. These are Filecoin, an evolution of IPFS, the decentralised storage platform Storj, and the indexing protocol The Graph.