How BitTorrent Works

Sampathkumar
5 min readSep 29, 2018

--

BitTorrent is a protocol (communication procedure or system of rules) used to download large files of television series, HD movies, and videos in a minimum bandwidth on the internet.

Before getting to know about BitTorrent, we need to know something about the fundamentals of file download and upload on the internet. There is a huge amount of data on the internet where users tend to upload and download data in the form of audio, video, pictures, files of different types etc. Let us see how this works.

Consider a simple example of downloading a freely available mp3 song on the internet. You will fire up your browser, type your favorite website or the song name on the search bar and hit enter. while doing this

  • The web browser software you use to search for the song sends a request to a server(a type of computer that manages requests and serves files on the internet).
  • If the server has the file the file transfer is done using either HTTP or FTP protocol.
You send a request to a server and get your song as a response

The way you have seen to get your files from the internet has some factors which determine your download speed.

  • The protocol which you use (i.e) HTTP or FTP determines the speed of your download.
  • You are not alone in this world, so same as like you, other people also request for the same song. This factor depends upon the popularity and demand for the song or the file. As the number of requests increases, the server takes much longer time to respond and process all requests.

So what’s the way to solve this?

Here comes one of the better way of file sharing system called Peer-to-Peer file sharing system. (peer — the computer which is connected to the internet or other internet users like you)

  • In Peer-to-Peer file sharing system a software (different from the browser you search for) is used to download the files. This software searches for the required mp3 song on the internet. This time it’s not from the usual servers, rather it's from the users like you on the internet.
  • Consider you are USER 1 in the Peer-to-Peer network. If one of the users contains the mp3 song with the same software running on his/her system for eg: USER 2, the file would be taken from there for the download. Here USER 2’s system acts as a server.
  • This greatly reduces the overhead for the server which generally responds for the requests you make.
  • In the same way, when you download a file from the internet if you have any of the files that other users looking for on the internet your system will serve those users acting as a server.

But this kind of file sharing have some disadvantages.

  • It’s always not sure to find users on the internet having the same kind of software running on their system with the song which you look forward to download.
  • If the user A is downloading a file from the system of other user let’s say user B, user B may disconnect from the network at anytime. So the download will not be consistent.
  • These kind of problems make even worse for us to search and download our required files.
  • The people who leave the Peer-to-Peer network after completing their download not allowing other users to obtain files from their system are called as Leechers. This kind of action is called Leeching.

BitTorrent comes into the act here

In order to avoid leeching problems BitTorrent use many strategies of which some of the important things are mentioned here.

BitTorrent uses seeds, peers, swarms, a central tracker, tit-for-tat rank, to solve these problems.

  • Seeds — Seeds are the BitTorrent files which are completely downloaded in the user’s system. There should be at least one seed in BitTorrent network to start a download of your favorite content.
  • Peers — Peers are the other users connected to the BitTorrent network.
  • Swarms Swarms are the users in the system who are downloading and uploading files on the BitTorrent.
  • Central tracker — Central tracker receives users data from all over the network to serve the requesting users.
  • A central tracker (like a server) uses a strategy called tit-for-tat where the user who wants to download a file from BitTorrent network must share some of his files for upload.
  • The BitTorrent sends some of the file contents to the central tracker server while the user tries to download some content from other users of the same network.
  • The content took from the user to the central tracker is used to serve other users on the BitTorrent.
  • If the user abruptly quits from the BitTorrent network after downloading contents from the network the user’s rank in tit-for-tat strategy would be reduced.
  • As a result, the user won’t get fair download speed if he tries to download files on the BitTorrent network in future.
  • The user who leaves the computer online without quitting from BitTorrent network after downloading files will get a higher rank and higher download speeds.

What about the download speeds on the BitTorrent network?

  • The files which you download from BitTorrent network will not be shared from the same user system. Instead, it’s shared from different users as different pieces.
  • The pieces of the file are downloaded in a smaller download speed. If the download speed of all the pieces of the file is added we get a better download speed.

By this way, the BitTorrent works on the peer-to-peer network. Using BitTorrent is legal but downloading copyrighted content from BitTorrent is illegal. Be careful on using torrents !.

--

--