How Torrents work and why do we use them?


If you are a technology geek, then you may have wondered 'How do torrents work?'. Let's explore this topic today.

Traditional Client-Server Downloading:


Before understanding how torrents work?, let's make ourselves clear about why do we use torrents? It's really a long discussion but not too complicated, but let us get started. You all are familiar that the content you download from the internet is first uploaded by someone.

Let's examine what happens when you download a file from a website:
  • You open a Web page and click a link to download a file to your computer.
  • The Web browser software on your computer (the client) tells the server (a central computer that holds the Web page and the file you want to download) to transfer a copy of the file to your computer.
  • The transfer is handled by a protocol (a set of rules), such as FTP (File Transfer Protocol) or HTTP (HyperText Transfer Protocol).


Take the example of downloading a file from 4shared.com. Someone uploads the file on 4shared first. Suppose, I draw a picture on paint, save it, name it 'XYZ' and upload it on 4shared.com. Now where does this uploaded file (the picture) go? It goes to the 4shared servers. Servers are ,kinda, powerful computers capable of fast processing speed as compared to the PCs (Personal computers, which you and I use everyday). Servers process more storage, as well. So, now my file is uploaded (or Stored on a server) on 4shared.
Now, I tell a friend of mine that I have uploaded a file named 'XYZ' on 4shared which you should see. What he will do is open www.4shared.com and search for 'XYZ'. Then, he clicks the Download button. When he clicks Download ,what happens behind the scenes is that your computer contacts the 4shared server on which your file is stored and makes a download request. The server gives the permission and the file starts downloading on your computer (and the server starts uploading the file).
But what if the size of the file is very large too many people are downloading the same file, out racing the server's capability to transfer. Definitely the downloading process experiences connection breakups or may even stop. The transfer speed is affected by a number of variables, including the type of protocol, the amount of traffic on the server and the number of other computers that are downloading the file. If the file is both large and popular, the demands on the server are great, and the download will be slow.



This is where the torrents enter. Torrents make use of Peer-to-peer file sharing. Let's first understand what is peer-to-peer file sharing.

Peer-to-peer file sharing:

Peer-to-peer file sharing is different from traditional file downloading. In peer-to-peer sharing, you use a softwareprogram (rather than your Web browser) to locate computers that have the file you want. Because these are ordinary computers like yours, as opposed to servers, they are called peers. The process works like this:
  • You run peer-to-peer file-sharing software (for example, a Gnutella program) on your computer and send out a request for the file you want to download.
  • To locate the file, the software queries other computers that are connected to the Internet and running the file-sharing software.
  • When the software finds a computer that has the file you want on its hard drive, the download begins.
  • Others using the file-sharing software can obtain files they want from your computer's hard drive.
The file-transfer load is distributed between the computers exchanging files, but file searches and transfers from your computer to others can cause bottlenecks. Some people download files and immediately disconnect without allowing others to obtain files from their system, which is called leeching. This limits the number of computers the software can search for the requested file.


How Torrents work:

Unlike some other peer-to-peer downloading methods, BitTorrent is a protocol that offloads some of the file tracking work to a central server (called a tracker). Another difference is that it uses a principal called tit-for-tat. This means that in order to receive files, you have to give them. This solves the problem of leeching -- one of developerBram Cohen's primary goals. With BitTorrent, the more files you share with others, the faster your downloads are. Finally, to make better use of available Internet bandwidth (the pipeline for data transmission), BitTorrent downloads different pieces of the file you want simultaneously from multiple computers.
Here's how it works:
  • You open a Web page and click on a link for the file you want.
  • BitTorrent client software communicates with a tracker to find other computers running BitTorrent that have the complete file (seed computers) and those with a portion of the file (peers that are usually in the process of downloading the file).
  • The tracker identifies the swarm, which is the connected computers that have all of or a portion of the file and are in the process of sending or receiving it.
  • The tracker helps the client software trade pieces of the file you want with other computers in the swarm. Your computer receives multiple pieces of the file simultaneously.
  • If you continue to run the BitTorrent client software after your download is complete, others can receive .torrent files from your computer; your future download rates improve because you are ranked higher in the "tit-for-tat" system.
Downloading pieces of the file at the same time helps solve a common problem with other peer-to-peer download methods: Peers upload at a much slower rate than they download. By downloading multiple pieces at the same time, the overall speed is greatly improved. The more computers involved in the swarm, the faster the file transfer occurs because there are more sources of each piece of the file. For this reason, BitTorrent is especially useful for large, popular files.

No comments :

Post a Comment

Share