What Is a Peer-To-Peer Network? (With Examples and Benefits)

What Is a Peer-To-Peer Network?

A peer-to-peer (P2P) network is a way for two or more computers to share files and for computers to access devices such as printers.

The earliest examples of P2P networks came from the first freestanding PCs in the 1980s – when computers no longer needed to be linked to a central system but were completely self-contained. While this meant more freedom for the user, it was also much more difficult to share data or send something to be printed without having to save it to a floppy disk and physically take it to the user who had a PC connected to the printer.

The development of peer-to-peer (P2P) networks allowed all computers to be connected to each other and share resources, such as printer access.

Each computer on a P2P network is called a ‘peer’ or ‘node’.

Each node serves as both a client and a server – they make use of the resources while simultaneously providing resources to others. These might be files, access to a printer, storage, bandwidth or processing power. Each user can decide what can be shared from their PC with access rights.

Other networks, such as client/server networks, might have a separate server computer or need server software – but these are unnecessary for P2P networks.

In direct opposition to client/server networks, no specific peer in a P2P network has authority. This egalitarian network means that each PC has the same rights regarding communication, finding and using resources, and validating other users.

A P2P network can be as simple as linking two computers using an ad-hoc connection through USB or a permanent connection using copper wires like in a small office, or up to a much larger network operating across the internet using special protocols and applications.

Types of Peer-to-Peer Networks

There are three different types of peer-to-peer networks.

Each has slightly different characteristics and benefits and, more importantly, different levels of complexity.

In terms of hardware, the link between peers can be virtual or physical – and the minimum physical connection is a simple USB.

Unstructured Networks

These are the simplest type of P2P network. The nodes (PCs) are connected on a random basis. They are simple to build – making them suitable for most situations.

The nature of the unstructured network makes it straightforward for localized optimizations, but the shared resources can be difficult to find.

Files might be stored with more than one peer; and when a search request goes into the network, the most popular files are easy to find.

However, a rarer file – one that is not shared on many nodes – can be lost in the ‘flood’ of requests, making it much harder to find that content.

Unstructured networks tend to use more CPU and memory, but they are less affected by the number of peers joining or leaving the network (churn rate).

Structured Networks

Unlike the unstructured network, the structured P2P network is organized into an arrangement based on a distributed hash table (DHT).

DHT is an advanced form of lookup or search system that allows nodes to access data, such as files, through the use of a key instead of having to make a copy of the data on every node. These keys are formed through hashing – whereby data of varying sizes are assigned generated values of the same size (for example, a mix of 10 digits and letters).

This contrasts with unstructured P2P networks, where whole files may be stored on more than one node.

DHT assigns ownership of a particular file to a specific peer using a variant of hashing called ‘consistent hashing’. When a new peer joins a P2P network, normal hashing requires that all keys be regenerated. Consistent hashing is less power-intensive as only some keys need regenerating.

Overall, it is easier, and less power- and memory-intensive, to search a structured network for content than an unstructured one.

However, this type of network is more problematic with high churn rates – the routing of requests and information depends on each peer knowing what is available to download and other criteria of the neighbouring node, which must be ‘relearned’ when peers leave or join the network as the neighbours change.

Hybrid Structure

This is a structure that looks more like a traditional client/server network.

A centralized peer is in control, performing server-like activities with optimum knowledge of the location of files and what resources can be shared.

This is a more complicated network and can prove more intensive to set up.

While it makes many routing requests faster, it puts more pressure on the centralized peer, requiring it to potentially have more power and use more CPU than other nodes. It is a move that is much closer to having a dedicated server and an administrator.