Peer-to-peer network
What is a peer-to-peer network?
A peer-to-peer (P2P) network is a collection of connected computers with no single controller. Each participating computer, called a peer or a node, is both a user and a provider of resources. Peers contribute to a P2P network by sharing resources such as storage space, processing capabilities, and bandwidth. A P2P network is decentralized, which makes it different from the traditional client/server arrangement where a server only provides content and a client only uses content.
P2P networks have varied applications, but the most common is media sharing (like music, movies, and games). Because there’s no central controller, all content stored on the network is distributed across the peers. Content may be stored in multiple locations, and each peer is equally capable of providing other peers with requested content. Peers may also contribute to managing network traffic and file location processes.
What are the main uses of peer-to-peer networks?
The original vision of the World Wide Web was similar to a peer-to-peer arrangement, where all WWW participants would both use and provide content on a decentralized system of interconnected but independent computers. Usenet, which predates the Internet by about a decade and is still in use today, is an information sharing system where a user posts a message which is then copied throughout a network of shared servers, thus using some aspects of a P2P network.
The first instance of the type of P2P networks that many are familiar with today came about in the 1990s—a music sharing network called Napster. The Napster network was eventually shut down over legal issues regarding copyright infringements. However, file sharing remains a common use of P2P networks—BitTorrent and IPFS are two examples available today. But file-sharing isn’t the only use for P2P networks.
Web3
Considered the next iteration of the Internet, Web3 reimagines the Internet with a decentralized infrastructure. The current Internet (also called Web 2.0) is organized around central servers that provide all the platforms and content that users interact with. The entities that control these servers have the power to determine what content is available and to whom. They also have sole control over and responsibility for user data.
Web3 still provides social media, video streaming, and other applications available on Web 2.0. But Web3 supports these activities with a decentralized P2P network. Web3 stores the applications and user data on encrypted mini databases (called blockchains) distributed across many peers. This means no single entity has sole control over any platform, piece of content, or access. Instead, a decentralized network of peers work together to produce and maintain an accurate record of the blockchain, financially incentivized by cryptocurrency rewards.
Other examples of P2P in use today
Peer-to-peer networks are also used to meet a variety of other needs, including:
- WebRTC applications (online gaming, meetings, etc.) use P2P for improved performance. Allowing users to connect to one another directly avoids the inefficiency of routing everything through a server, and thus results in faster data delivery.
- Direct communication apps like WhatsApp use P2P for voice and video calls, and chatting.
- Volunteer computing builds a P2P network that taps into volunteered processing resources. An individual becomes a peer when they connect to a network and donate a portion of their computer’s processing capabilities to help complete complex data analysis projects. A good example of a project that uses volunteer computing is Folding@home.
- An office can set up a small in-house P2P network to share files among employees. Even two home computers sharing files on each other’s hard drives is an example of a local P2P network.
- Botnets are built as P2P networks for improved delivery of malware, and for resilience against efforts to shut them down.
Types of peer-to-peer networks
A core principle of any P2P network is that no single entity has complete control over any particular content because that content exists in multiple independent locations and is controlled by many parties. However, the mechanisms used to deliver content from one node to the next can vary from network to network, depending on the type of P2P network.
Unstructured
This is a pure application of P2P. Nodes are connected to other nodes on the fly as they join the network—there’s no overarching organization. The upside of unstructured P2P networks is that they’re easy to build, and can handle a high frequency of nodes joining and leaving (called “churn”). A downside is that the lack of organized communication between nodes can cause inefficient searches. A search request is either broadcast widely across the network, or passed from node to node until the requested content is found. This uses lots of network resources, and can be unsuccessful if the requested content is obscure and hard to locate.
Structured
A structured P2P network introduces a hierarchy to the nodes’ interconnectivity. Nodes are connected in an organized fashion to maximize efficiency. New content or a new location of existing content is logged into a “map” called a hash table. Search requests use this “map” to find the best location to retrieve the content from. Having nodes and content organized and quickly locatable makes for a more efficient network. However, when the network experiences churn, it can be a challenge to maintain the structured organization of node connectivity and to keep hash tables up-to-date.
Hybrid
A hybrid P2P network aims to reproduce the best features of both the structured and unstructured models. In a hybrid P2P network, a central server keeps track of nodes and helps one node find another. The central server also oversees the indexing of content. A node looking for content contacts the central server to find where the desired content is, but then communicates directly with the node identified as having the content. The content doesn’t pass through the central server. In this way, the hybrid approach gains an efficiency advantage from having a reliable and robust central server, while still tapping into the performance advantages of nodes working together directly.
What are the advantages of peer-to-peer networks?
There are good reasons some Internet applications choose to use a P2P structure, including:
- Inherent scalability: When a node joins the network, it adds to network capacity at the same time it’s adding to demand. One node leaving or not performing well can be offset by the rest of the network.
- Increased stability: Because data doesn’t reside on a single server, access to data can’t be lost due to a server experiencing an attack or outage.
- Longer-lived content: It’s very difficult to completely remove data stored in multiple locations. In contrast, data found only on a single server is easy to take out of circulation, whether voluntarily, through censoring, or by outside forces like hackers. Data longevity also means improved archiving of older material.
- Better performance: Direct communication between nodes means shorter transmission routes and faster response typically. In the case of a large data file, the data can be partitioned into smaller pieces, with each piece delivered by a different peer. Receiving data from multiple sources simultaneously means collecting a large file takes much less time.
- Cost savings: Peers replace expensive servers, reducing the costs of meeting high demand content requests.
Are there risks associated with peer-to-peer networks?
P2P networks can improve your Internet experience. But they come with their own security and privacy risks, as well as other issues like:
- Risks to nodes: Any network traffic routed through your computer while it’s functioning as a node can be seen by other nodes on the network. Your ISP may throttle your bandwidth if they flag as suspicious the volume of traffic you’re hosting. (Fortunately, layering on a P2P-friendly VPN can add security against these risks by hiding who you are, where you are, and what content you’re uploading or downloading.)
- Loss of security: Some P2P networks are better than others at providing a secure environment for your data.
- Contaminated content (like malware): Early P2P networks saw lots of corrupted files being passed between nodes. Current P2P networks have improved security and encryption protocols to combat this, but the threat remains.
- Content discovery: P2P is good for finding popular content, but can be more difficult for finding less common or niche content. If content exists only on a single node, and that node leaves the network, the content can disappear.
- Legal issues: A P2P network can be attractive to bad actors, because it can allow for circumvention of copyright laws and enhanced anonymity, and make it overall more difficult to remove illegal material and dismantle illegal sites. This can make P2P networks more likely to be snared in legal investigations.
- The so-called “freeloader” problem: Nodes are often free to join a network to use the network’s resources, but aren’t necessarily obligated to contribute their own resources back to the P2P pool. The robustness of a P2P network depends on resources that nodes bring to the group. If nodes habitually use more than they contribute, the network performance suffers.