Introduction
Many online services for file sharing are quite popular, however, it is possible that none of them have both featured as the BitTorrent: it of a P2P system (peer-to-peer) that offers an efficient, fast and stable, especially for sharing large files (hundreds or thousands of megabytes).
But, what makes BitTorrent such these characteristics? How BitTorrent works? How to use the BitTorrent? As additional resources — DHT and PEX, for example — to improve its features? BitTorrent is synonymous with piracy? To answer these and other questions, I, Emerson Alecrim, explain the following key concepts behind the technology of BitTorrent.
What is BitTorrent?
Created by developer North American Bram Cohen in 2001, BitTorrent is a system that enables the sharing of virtually any file over the Internet, being used mainly for distribution of videos, music and software.
BitTorrent is quite popular because it is an easy tool to use and, at the same time, it is very efficient. This is due basically to two reasons:
– when a file is being downloaded to a computer, “bits and pieces” of this are obtained several other machines simultaneously, not just one;
– at the same time in which a computer retrieves a file, data that has already been downloaded alsoare shared, that is, to receive it is also necessary to provide.
The BitTorrent itself, in fact, is a protocol for sharing data and not a centralized system. There is a server providing the data, but rather a standard of communication between various computers that allows files to be located, distributed, and obtained by all.
Advantages of BitTorrent
The BitTorrent has been the preferred option of a lot of people to share files. Not for less, this is one of the most popular protocols of the Internet and this is due to several reasons, among them:
– Security: the BitTorrent is very safe, because it shares only the file you are downloading or have already downloaded. It is extremely difficult, for example, an attacker use the share to access unduly a computer (unless you are downloading a file already contaminated, but this is not common);
– Cross-platform: the BitTorrent is multiplatform, that is, it is not intended for a single operating system. You can use it on Windows, macOS, Linux, and even on platforms mobile, as the Android;
– Free: you do not need to pay anything to use BitTorrent;
– Continue where you left off: you do not need to leave your computer on until the download end. It is possible to pause the download and continue it later from the point of interruption;
– Distribution cheap: an organization that needs to distribute software, for example, you can do it via BitTorrent, avoiding expenses with the acquisition of servers for this purpose.
How BitTorrent works?
Torrent
So that you can make the download (to download data) and upload (sending data) by BitTorrent, it is necessary that each shared file is associated with a torrent. It is a small file (typically has only a few kilobytes) and simple, but that contains the necessary information to share, such as size in bytes of the content to be shared, data that confirms the integrity of this, the addresses of trackers (the server that directs the communication of the sharing, a concept discussed further below), etc.
Here are some of the fields that are found in a torrent file:
- announce: tells the tracker that deals with the distribution of the file;
- announce-list: informs any trackers auxiliary;
- comment: a comment any inserted by the creator of the torrent;
- created by: informs you which software the torrent was created;
- info: contains all the data for the file, such as name, size, code integrity check (hash), etc.
This means that you are unable to find a particular file to download (a movie, for example), it is necessary to first find a torrent associated with it. Type files usually have the extension .torrent.Then, the torrent has to be opened in an appropriate program (the client) and, therefore, able to start the download of the material.
Seed, peer, leecher, tracker and swarm
So that you can understand how BitTorrent works, it is necessary to know five denominations basic that are related to the file share:
– Seed (the sower): is the name given to each machine that has the file *full* that is being shared. It is necessary that there is at least a seed for that sharing to occur fully;
– Peer (point, node): term that indicates each computer that shares files. When you are downloading something through BitTorrent, your computer assumes the role of a peer, that is, a point or node on the network;
– Leecher (“sucker”): the term refers to the computers that are still downloading files or that you have already downloaded completely, but for some reason are not sharing;
– Tracker (tracker): the tracker is a server that maintains the communication control among all the seeds and peers, so that the computers involved in the process can know which machines to connect to. Note, however, that the tracker does not have a copy of the file, much less interfere directly in the share.
– Swarm (swarm): name given to the set of computers that are sharing the same file. If, for example, the file abbreviationfinder.avi is being shared by eight seeds and 34 peers, the swarm of the file contains 42 computers (eight seeds + 34 peers).
The share itself
Now that you already know the “protagonists of history”, is more easy to understand how BitTorrent works.
When you open a torrent file on a client (program) of BitTorrent, this looking for a tracker which, in turn, find the swarm that contains the shared file, or is, indicate both the machines have the full content (seeds) and those that have partially.
The tracker then directs the communication so that your computer can pick up “bits and pieces” of the file from the swarm. Note that the machines that have only parts of the file are also downloading, but already share what they have. The same will happen with your computer.
This is possible because each file shared in BitTorrent is divided into small equal parts calls parts. These can be 16 KB, 32 KB, 1 MB, anyway, it depends on how the sharing was done. To facilitate transmission, each piece can be further subdivided into blocks.
Thanks to this scheme, it is possible to share parts of the file even if it is not completely downloaded: the computer will send only those parts that you already own. Another advantage is that the pieces do not need to be downloaded sequentially. As an example, assume that a file you have 100 parts; if a peer has the parts 78 and 83, for example, there is no problem in downloading them before theparts 18 or 23.
This way of working influence on another feature of BitTorrent: the protocol has a algorithm called Rarest First (something like “rarest first”) able to decide what the next piece the be downloaded will be the one most rare, so as to increase the number of copies in the swarm and to avoid that the download complete file take too much.
There is also a process that analyzes each data packet to determine a sequence number call hash. This information is associated to its respective piece. When this is lowered, the calculation is done again and compared with the hash earlier. Both have to be the same — if there is a difference, the piece is discarded, since it has been changed or corrupted in some way.
The computers that are part of the swarm communicate constantly with the tracker to tell how much of download has already been done and how much is still missing. Thus, the tracker can target your machine for other than in need of the data that you have already downloaded at the same time in that show which computers have the rest of the file that you are missing.
The interesting thing is that, if the tracker stop working for some reason, the download is not interrupted. This is possible because the swarm continues to share the file, since each computer that integrates them know of where download. However, no other machine can do part of this swarm while the tracker do not return to work.
Speed download
The download speed on BitTorrent will depend on several factors and not only the capacity of your connection to the Internet. One of them — and perhaps the most important — is the amount of machines are in the swarm.
Imagine that a certain file has 40 peers, and 28 are seeds. The download tends to be more fast because the number of machines that has full copies of the file is considerably large, in order to facilitate their distribution. Now, assume that the swarm has 35 peers, but only three seeds. Then there is only three computers with the full version file and more than 30 machines requesting it. With such high demand, the distribution will take longer.
The speed of your downloads can also be influenced by how much you share. If your BitTorrent client to be adjusted to allow an upload rate very low, as a rule, your computer will have less priority in the download.
The control is done, for example, by means of algorithms of choking, which consider the aspect of reciprocity, better known as tit-for-tat (something like “an eye for an eye”): with it, a peer determines in intervals of time regular (every 10 or 20 seconds, for example) to which other nodes will share data in the next step with the basis of the rates of downloads coming from each and every one of them; the peers with the highest speeds in the last seconds assessed end so being favored.
In this sense, it could be that you are not sharing anything (leeching) and, consequently, obtaining rates download low by any problem without a computer, such as a firewall misconfigured preventing the output data from the BitTorrent client.
Disadvantages of BitTorrent
By knowing the basic operation of BitTorrent, you are able to understand not only why of its popularity, but also some of its possible disadvantages:
– reduction in sudden the download speed: it may happen when there are few seeds in the swarm and these are unavailable (your computer may have been turned off, for example). That is why it is important that you can stay connected for at least a few many after the end download — this is a form of help other users to complete the procedure;
– torrents without seeds, with the passing of time: one of the key problems with BitTorrent is that, as the over time, the torrents can be without seeds. This is because people remove the downloaded file from your computer, switch the name, change the folder and so on;
– consumption of almost the entire width of the band: it may happen for the downloading procedure to use almost all the speed your connection to the Internet. If this is shared, the other users may be affected. To avoid problems of the type, it is recommended to limit the upload and download rates on your BitTorrent client.
Another possible disadvantage is a problem that does not depend on lack of seeds or the speed of your connection user: the practice of Traffic Shaping.
What is Traffic Shaping?
The Traffic Shaping is a limitation imposed by the access provider to the Internet that prevents the ability of the connection to be used in its entirety. It is legitimate when the user reaches the download limit contractor’s and its speed is reduced, for example — a procedure quite common in connections mobile networks 3G and 4G. The problem is when the Traffic Shaping is done improperly.
Unfortunately, esaa situation is common. Internet providers in various parts of the world identify certain streams of data and, with this, you can stop it very demanding applications, such as streaming video and BitTorrent, to harness the potential of the connection. When this happens, the user realizes that his download rate does not pass 100 KB/s (kilobytes per second), for example, even with its connection supporting up to 500 KB/s.
This is a controversial subject, after all, no provider assumes the practice, and from the point of view of the user, it is quite difficult to identify when the Traffic Shaping is being done. Fortunately, there are some techniques that attempt to work around this problem, such as the use of encryption to make it harder the identification of the associated data to the share.
How to use BitTorrent?
Now that you already know quite a lot about the functioning of BitTorrent, it becomes easier to use it. The first step, if you have never used the service, consists in downloading a software client. There are several of them, for many different platforms.
With the app downloaded and installed, the next step is to find torrents of files that you want to get.The best way to do this is to use specialized sites. There are dozens of them, just do a search on Google to find them.
In all of them, it is important that you note the amount of seeds and leechers of the torrent. If there are few seeds, the download may be time consuming, as you already know, and perhaps it is only look for another torrent.
When you have found the torrent for the file that you want to get, just download it and open it with the client. Normally, clicking the torrent, the operating system itself takes care of opening the application. This, in turn, may ask you where you want to save the file to be downloaded.
The download will start, just you to accompany him. Note that you can pause the download, or cancel it and see a lot of information about the procedure, such as download rate, upload rate,amount of peers and so on. The resources, of course, vary depending on the client used.
If what you want is to create a torrent to distribute a file, you can also use a software client. In the case of the official client of the BitTorrent, all you need to do is go under File and choose Create NewTorrent (or equivalent). Then, simply locate on your computer the file to be shared (can be more than one) and fill in the fields, when you need to. The software itself will indicate the trackers (although you can also do it) and will add integrity information.
Note that, as you are the creator of the torrent, your computer will be the only seed the file for some time. As more machines are downloading the file, the number of seeds will increase.
The BitTorrent is illegal?
BitTorrent is not illegal. Above all, we are talking about a protocol for sharing files on the Internet that can be used for various purposes, including for distribution of protected material by law. But that does not make the technology wrong.
In fact, BitTorrent is often used for distribution of movies, music, games and pirated software. But all that content is always stored on users ‘ computers. The BitTorrent trackers do not take advantage of what is being shared, much less store the files. Its function is only to enable the communication between the peers.
In this sense, the BitTorrent also can — and is — used for legal purposes. Independent producers of video, for example, they can use the service to distribute movies of your authorship; software companies can save server resources share their products through this means.
The Canonical is an example. The company is responsible for the famous Linux distribution Ubuntu. In addition to allowing users to download the operating system from its servers, the company also provides copies via BitTorrent.
Want another example? The own BitTorrent Inc., the company responsible for the maintenance of the protocol, has a service legal sharing legal content: the BitTorrent Now. Through it, artists independent distribute videos and music for free or through payments that give access to the additional content.
As the technology cannot be held responsible for the use of it, the entertainment industry, the main “voice” in the fight against the distribution inadvertent rights-protected content copyright on the Internet, seek to take action against sites and tools that distribute torrents supposedly illegal. But, in the practice, these efforts give a few results: if a popular service crashes, as soon it appears another.
Additional resources
In order to enhance certain features or overcome limitations, the BitTorrent protocol receives tweaks and additional features over time, many of whom hail from originally software clients. The following, some of the most outstanding.
Protocol DHT (Distributed Hash Table)
The DHT (Distributed Hash Table) is a complex system that enables the use of the BitTorrent waytrackerless, that is, without that the peers have to query trackers. This is possible because solutions of the type using a feature called the table of hashes that enables each node to find the other members of the network in an efficient manner.
As this is a distributed system and a decentralized location information are passed from one peer to the other, so that the input or, especially, the shutdown of us do not to compromise all communication and, consequently, the share. Thanks to this scheme, trackers in nothing or little need to be consulted.
It is valid to point out that the protocol DHT is not only used for networks BitTorrent: it is also possible to find implementations of this system in other sharing tools of files, in the services of DNS, etc.
PEX (Peer Exchange)
The PEX (Peer Exchange) does not require the use of trackers, but makes these work less. This is because this solution allows the peers to exchange certain information between themselves directly,without the intermediary of the tracker. From PEX, a peer may, for example, to inform another node to the location other computers in the swarm via tables DHT.
Magnet Links
The Magnet Links are seen as an alternative to torrent files. These must be downloaded and, subsequently, open in the client program. The Magnet Link, in turn, is opened as soon as clicked on a page, enabling the download of the shared file immediately.
As the Magnet Links are compatible with the DHT and PEX, it is possible to integrate the computer to a swarm and find other peers without the need of trackers.
The Magnet Links have been a solution increasingly adopted by web sites that specialize in BitTorrent because, when there is an absence of for torrent files, and addresses the direct (the location of the file if gives by means of hash), it becomes more difficult to associate them to the undue distribution of protected material.
Such as the DHT, Magnet Links are also used in other services, not limited to BitTorrent.
Protocol µTP (uTP)
The protocol µTP (µTorrent Transport Protocol) — also called uTP, for the comfort and convenience — it is quite interesting because it can assess the impact of downloads via BitTorrent on the connection to the internet user.
If the protocol is “notice”, for example, that the downloads are messing up the loading of pages in Internet browser, the bandwidth destined to BitTorrent is decreased automatically.
The opposite is also true: there is availability, the bandwidth share increases. As if that weren’t enough, the µTP also has the resources to try to “circumvent” barriers placed by providers to impair the downloads (the already mentioned Traffic Shaping).
The uTP is from one of the clients for torrents more popular than it exists: the µTorrent (or uTorrent). Its popularity and its resources have to be acquired by BitTorrent Inc. at the end of 2006.
An Altruistic Manner
In September 2016, the BitTorrent Inc. introduced a feature called Mode Selfless (Altruistic Mode)that basically makes the user’s computer to send more data than the amount downloaded. It is a feature that causes suspicion, after all, you can leave the download much more time-consuming.
On the other hand, the BitTorrent points out that the idea can be useful in certain circumstances, especially in the sense of to increase the efficiency of a swarm. For both, the indication is that the Altruistic manner to work in ratio of 2 for 1: the computer has to send two pieces of data to download.
Note, however, that the clients of BitTorrent compatible with the Altruistic manner leave the feature disabled by default. The user need to decide if you want to contribute with a swarm (hence the term altruistic).