Peer to Peer

Definition
A pool of servers, distributing content. Each document may be located in one or servers on the network.

This pattern is mainly used to for media sharing: video, games, books. Each media item is located on one or more servers, and servers can be added and removed at will.

Peer to Peer architecture diagram

How does it work?

There are two aspects to be considered. The first is: how do the nodes know that the others exist?
A new node is added when a person adds the address of this node to the address table of some other node already in the network.
The nodes themselves forward the addresses to the nodes with which they are directly linked.

The other aspect is resource discovery: how does one node know where to find a resource?
The simple solution is to send a request to all peers and wait for the response.
The advanced solution is the use of some sort of a data structure that tells each node where to find a resource.

Examples

  • USENET
  • Filesharing services like Napster, Kazaa, and many others

Where does it come from?

Though the concept was much older, the architecture became popular with the advent of Napster (in 1999), the filesharing service that got into trouble because it was used for sharing illegal music and video copies.

When should you use it?

  • Use it when there is a large set of resources to be maintained and shared by a large group of people.
  • Use it for its lack of a single-point-of-failure. Any node may fail temporarily or permanently and the system will not suffer.

    Problems

  • When the system is open, there is a chance that it will be misused.
  • Resource detection in a network with much churn (many nodes leaving and joining) is a hard problem.

    Common implementation techniques

    Links