Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

general
communitycreator

What is the peer to peer architectural design?

Fatima Hasan

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

In a peer to peer (P2P) network, two or more systems are connected together and they share resources without the need of a central server. Connection between these systems can be physical or via the internet. Each system is a server as well as a client, and can request or share resources whenever needed.

Example of a P2P network

In order to be a part of a P2P network, P2P software is required, which allows users to share files with all other users who are a part of the network. Some P2P software examples are:

  • Kazaa
  • FrostWire
  • LimeWire
  • Acquisition

Once part of the network, a user can access the files of other users, and other users can access their files as well. The folder containing resources to be shared is designated by the user.

Example - BitTorrent

BitTorrent is a very famous P2P protocol that allows users to share data in a distributed manner. It is mostly used for the transfer of video and audio files, such as movies and songs. To use it, users have to download a BitTorrent client such as μTorrent on their system.

BitTorrent tracker

BitTorrent tracker is a server that helps peers communicate effectively and efficiently. It keeps a list of the peers and which files they have. When a client makes a request for a file, the tracker knows which peers are available and coordinates the transmission from server peer to client peer, as well as reassembly of the requested file. Reassembly is required because pieces of the file may be downloaded from different peers.

Seeders and leechers

Seeders: The peers which act as a server. They have the complete file downloaded and are sharing it with other users.

Leechers: The peers that act as a client. They have requested a file and are downloading it.

The download speed is directly proportional to the number of seeders of any file. If multiple peers have access to the complete file, each can share a piece of the file. Users can download these separate pieces simultaneously because download speed is always greater than upload speed.

However, if there are no seeders and only leechers, there won’t be anything to download because no peer will be sharing the file.

Advantages of the P2P Architecture

  1. Highly scalable: Since there is no designated server system, any number of peers can easily be added to the network without putting a strain on any resources.
  2. Increased system capabilities: Since each peer can act as a server, the system has more capabilities than a client-server architecture. Each server peer adds its capabilities to the overall system.
  3. Easy file sharing: File sharing is easier and speedier in P2P architecture than in any other architecture.
  4. Less expensive: There is no need for designated servers, which increase in cost as the network grows.
  5. Error/Fault-tolerant: In a client-server architecture, the whole system falls apart if there is a failure in the central server. In P2P, even if a peer faces failure, the rest of the network remains undisturbed.

Disadvantages

  1. Difficult to track changes: Since many peers may have shared files, it is very difficult to follow all the changes. When one peer makes a change, it needs to be reflected in the entire network.
  2. Less secure: Each peer needs to implement their own layer of network security, otherwise the entire network is vulnerable.
  3. Performance problems: Any system in the network may be accessed by all other systems at any given time, which may reduce its performance.
  4. No view option: Resources cannot be viewed before being downloaded.
  5. Illegal content: Copyrighted information may easily be transferred through the network.

RELATED TAGS

general
communitycreator

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring