BitTorrent Protocal

Abstract

When I was downloading a file using BT, I wondered why it was that fast. So in this essay, I try to figure out mechanism of BitTorrent Protocal.

Introduciton

BitTorrent is a communication protocol for peer-to-peer (P2P) file sharing which is used to distribute data and electronic files over the Internet. In a P2P system, all the people participating in the download are servers and also clients together.

The BitTorrent protocol can be used to reduce the server and network impact of distributing large files. Rather than downloading a file from a single source server, the BitTorrent protocol allows users to join a "swarm" of hosts to upload to/download from each other simultaneously. The protocol is an alternative to the older single source, multiple mirror sources technique for distributing data, and can work effectively over networks with lower bandwidth.

Terminology

  • block: A block is a piece of a file. When a file is distributed via BitTorrent, it is broken into smaller pieces, or blocks. Typically the block is 250kb in size, but it can vary with the size of the file being distributed. Breaking the file into pieces allows it to be distributed as efficiently as possible. Users get their files faster using less bandwidth.
  • client: the BitTorrent software used to download and upload files via BitTorrent protocal.
  • peer: one of a group of clients downloading the same file.
  • leech(er): usually refers to a peer that is downloading while uploading very little, or nothing at all.
  • seed: a complete copy of the file being made available for download.
  • swarm: a group of seeds and peers sharing the same torrent.
  • torrent file: a file which describes what file or files are being distributed, where to find parts, and other info needed for the distribution of the file.
  • tracker: a server that keeps track of the peers and seeds in a swarm. A tracker does not have a copy of the file itself, but it helps manage the file transfer process. For example tracker knows the exact address of the computers that completed downloading a particular file, or computers that are in the process of downloading a file.

Steps

  1. Creation: A user creates a torrent file associated with the data he wants to share with the help of a torrent client software. The torrent client software will include tracker address provided by the user and the cryptographic hashes (usually SHA-1) of all the pieces(small chunks) of the data.
  2. Share: The user share the torrent file he just created online.
  3. Download: Another user download the torrent file and open it using a torrent client software, The client will query the tracker server, which he got from the torrent file for the download location (clients who are downloading the file or completed downloading the file). One chunk is downloaded at a time from others at a time. On completion of download of each chunk the client informs the tracker, so that other people who want that chunk can download it. When all the chunks are downloaded, then this user will become a torrent seed for that data.

Others

  • seeder: seeders are the computers with the bittorrent client software installed and have completed downloading a particular data (with all the chunks), and act as a server for other clients to download the data. Basically seeders have completed downloading but still their clients are active in uploading data for other clients.
  • leecher: leechers are the computer clients who do not have the file, but are downloading the chunks from different clients. The chunks available with a leecher can be downloaded by other clients.
  • health: an overall health of a torrent data is the ratio between the total number of seeders and leechers. A torrent data having more number of seeders are considered to have a good health.

Reference

  • Wikipedia
  • What is bittorrent protocol and how does bittorrent protocol work
  • Understanding of BitTorrent Protocol

你可能感兴趣的:(BitTorrent Protocal)