P2P File Distribution and BitTorrent
Peer-to-Peer Distribution
Peers can help a server distribute a file. Once a peer receives data, it can contribute its own upload capacity to other peers.
BitTorrent
BitTorrent is a P2P file-distribution protocol. The peers participating in one file's distribution form a torrent. They exchange chunks, commonly illustrated with a 256 KB chunk size.
A joining peer initially has no chunks and accumulates them over time while also uploading received chunks. Once complete, it can leave or remain to help others.
When Alice joins, a tracker supplies addresses of selected peers. Alice attempts parallel TCP connections to them; successfully connected peers are her neighbors. Neighbors change as peers leave or new peers connect.
Different peers hold different subsets of chunks. Alice periodically asks neighbors which chunks they have and requests those she lacks.
Rarest first prioritizes the missing chunks with the fewest copies among current neighbors. Replicating scarce chunks helps balance availability rather than concentrating only on common chunks.
Preserve a rare chunk before its only supplier leaves
Unlock the complete interactive lab, deeper explanations, and curated reference answers.
KNOWLEDGE QUIZ
Capacity Lower Bounds
Let file size be in bits, server upload rate be , slowest peer download rate be , and recipient count be . Server-only distribution uploads bits, and each recipient still downloads :
For P2P, the server must supply at least one complete copy, while peers contribute upload rates :
These are ideal capacity lower bounds, not guarantees for every chunk schedule. Connection overhead, unavailable chunks, departures, and scheduling can increase completion time. A tracker helps discover neighbors; it need not carry every file byte.
KNOWLEDGE QUIZ
Compare ideal distribution bounds
Distribute a 12 Mbit file to three peers. Server upload is 6 Mbps, the slowest peer downloads at 4 Mbps, and each peer uploads at 2 Mbps. Calculate the client-server and P2P lower bounds, list the individual constraints, and explain why the P2P result is not a guaranteed completion time. Ignore overhead and assume peers stay available.