Peer-to-peer (P2P) architecture is a way of structuring distributed systems so that they can share a workload or tasks between them. Here each participating node behaves as both client and server and offers some of its own resources to the system.
There is no centralised server in P2P networks. So there is no dependency on a central entity for system administration. In other words, this is a decentralised architecture where tasks are delegated to all the peers instead of handled by a single server. But in some applications, a central tracking server is layered on top of the P2P network to help peers find each other and manage the network.
A peer-to-peer network does not have a dedicated server for user authentication. Since each computer is responsible for its own protection, a separate user account might be required for each computer that a user wants to access. Users usually save files on their own machines and are responsible for ensuring they are backed up properly. And the computer in a peer-to-peer network usually runs both client and server software. It can be used to make resources accessible to other users or access shared network resources.
Security is a major concern for peer-to-peer networks. Since access to data and resources is managed on each machine, each computer on this form may allow or deny access to other computers. For instance, users might share a folder on their computer containing payroll information, allowing other users to access the files in that folder. A single person doesn’t manage network administration because users can manage access to their computers' files and resources. Therefore, peer-to-peer networks are often used in small deployments and situations where security isn’t a major concern, such as home networks or small businesses.
P2P architecture works best when there are many active peers in an active network, so new peers joining the network can easily find other peers to connect to. There are enough remaining peers to take up the slack if many peers leave the network. There are fewer resources available overall if there are just a few peers. In a P2P file-sharing program, the more common a file is, the faster it can be downloaded because many peers share it.
The easiest way to do P2P work is to divide the workload into tiny bits that can be reassembled later. As a result, many peers will work on the same task simultaneously, and each peer has less work to do. A file can be broken down in P2P file-sharing so that a peer can download several chunks of the file from various peers simultaneously.
Some uses of P2P architecture:
Computing Some examples of P2P architecture:
There are three different types of P2P networks.
The nodes in unstructured P2P networks are not arranged in any particular order. This implies that node-to-node communication is random in nature. As a result, unstructured P2P networks are better suited for high-activity activities. For instance, people can choose to leave or enter the network regularly, so a social platform driven by P2P can take advantage of it.
Unstructured P2P networks, on the other hand, have a disadvantage in that they need a significant amount of CPU and memory to function properly. The hardware should be able to support the maximum number of network transactions, which ensures that all nodes should be able to communicate with each other at any given time.
Structured peer-to-peer networks are the exact opposite of unstructured peer-to-peer networks. Here, the nodes do have a way to interact with each other. This is possible thanks to a well-organized architecture that allows users to find and use files more effectively rather than searching randomly. Hash functions are used for database lookups in these types of organized P2P networks.
Structured peer-to-peer networks are inarguably more effective. They do, however, have some centralization because they use organized architecture. It also means that they would cost more to maintain and set up. Finally, it is more stable than an unstructured P2P network.
Hybrid peer-to-peer networks combine the peer-to-peer architecture with the client-server model. This is beneficial for networks that need a central server with P2P capabilities.
Structured and unstructured P2P networks are less effective than hybrid P2P networks. Other main benefits include a more strategic approach, increased performance, and more!
P2P networks have many advantages. This form of network, for example, can be more cost-effective since there is no central server to manage and pay for (apart from monitoring servers). As a result, there is no need for a network operating system, further reducing costs.
Another advantage would be that there is no single point of failure unless the network is minimal in the improbable case. Changes in peers do not affect P2P networks; if one peer leaves, the overall network is unaffected.
When a large number of peers enter the network simultaneously, the network can easily manage the increased load. Due to their decentralized nature, P2P networks can survive attacks fairly well since no centralised server exists.
To summarise, some features of peer to peer network are:-
P2P networks raise several security issues. If one peer becomes infected with a virus and uploads a snippet of the virus-infected file, the virus spreads easily to other peers. Furthermore, if a peer shares a sensitive file, it can be difficult to ensure that they have the correct permissions to access the network if there are several peers in the network.
Many users of P2P networks make use of resources exchanged by other nodes but do not share anything themselves. Leachers are the term for these types of free-riders. Although being difficult to shut down is a benefit, it can also be a drawback if used to promote illegal or unethical activities.
Furthermore, because of the widespread use of mobile devices, many businesses have switched to different architectures. With many people using mobile devices that are not always on, it can be difficult for users to contribute to the network without draining battery life and using up mobile data.
Some other drawbacks of the P2P network are:
Thanks to Navtosh Kumar for his contribution in creating the first version of this content. Please write in the message below if you find anything incorrect, or if you want to share more insight. Enjoy learning, Enjoy algorithms!
Subscribe to get weekly content on data structure and algorithms, machine learning, system design and oops.