Peer-to-peer file distribution

Peer-to-Peer (P2P) systems allow users' devices (peers) to communicate directly with each other with little or no central server involvement.

Scalability of P2P architectures

Solutions for distributing large files:

  1. client-server distribution:
    • the server sends a separate copy of the file to every peer
    • this places all upload bandwidth requirements on the server, creating a scalability bottleneck
  2. P2P distribution:
    • each peer can redistribute any portion of the file it has received to any other peers
    • this reduces the burden on the server and improves scalability

Model

Model component Description
\( F \) Size of the file to be distributed (in bits)
\( N \) Number of peers that want to obtain a copy of the file
\( D \) Distribution time: the time it takes to get a copy of the file to all \( N \) peers
\( u_s \) Upload rate of the server's access link
\( u_i \) Upload rate of the \( i \)th peer's access link: \( u_1 \), \( u_2 \), etc.
\( d_i \) Download rate of the \( i \)th peer's access link: \( d_1 \), \( d_2 \), etc.
\[ d_{min} = min\{d_1, d_2, … ,d_N\} \] Lowest download rate among peers

Client-server architecture

Explanation Formula
The server sends one copy of the file to each peer \[ N \times F \ bits \]
Minimum time for the server to upload all copies \[ \frac{NF}{u_s} \]
Minimum time required by the slowest peer to download the file \[ \frac{F}{d_{min}} \]
Minimum distribution time for the client-server architecture \[ D_{cs} = max\{ \frac{NF}{u_s}, \frac{F}{d_{min}} \} \]

The minimum distribution time is determined by whichever process takes longer:

  1. the time required for the server to upload all copies of the file
  2. the time required for the slowest peer to download the file

P2P architecture

In P2P systems, distribution time is harder to compute because peers also help share the file.

Explanation Formula
Minimum time for the server to upload the first complete copy of the file (initially only the server has the file) \[ \frac{F}{u_{s}} \]
Minimum time required by the slowest peer to download the file \[ \frac{F}{d_{min}} \]
Total upload capacity = upload rate of the server + upload rates of all peers \[ u_{s} + \sum\limits_{i=1}^N u_i \]
Minimum time to upload all copies to all peers (all \( NF \) bits must be uploaded, the server plus all peers share this work) \[ \frac{NF}{u_{s} + \sum\limits_{i=1}^N u_i } \]
Minimum distribution time is determined by the largest bottleneck \[ D_{p2p} = max\{ \frac{F}{u_s}, \frac{F}{d_{min}}, \frac{NF}{u_{s} + \sum\limits_{i=1}^N u_i } \} \]

The minimum distribution time is determined by whichever limitation takes the longest:

  1. the server must upload at least one complete copy of the file
  2. the slowest peer must finish downloading the file
  3. the time to upload all copies to all peers

Comparison

Assumptions:

Time from the start of the distribution until every peer has a complete copy of the file:

Distribution time for P2P and client-server architectures

A P2P system can become self-scaling because each new peer increases demand but also contributes additional upload capacity to the network.

BitTorrent

The most popular P2P file distribution protocol is BitTorrent (originally developed by Bram Cohen).

Many BitTorrent clients follow the BitTorrent protocol.

In BitTorrent:

BitTorrent is a complex protocol and system.

Most important mechanisms:

The trading incentive mechanism described above is often called tit-for-tat.

BitTorrent has a number of other interesting mechanisms:

Previous DNS All ⏎ Next Video streaming and CDNs

A Kemar Joint