Before delving into how BitTorrent works, it is important to have a little background of what BitTorrent is and how it can be used. A summary is that BitTorrent is a peer-to-peer file sharing protocol that allows individuals to share large files in a distributed manner. That means that instead of the file coming from me to you on a one-to-one basis, it could be distributed around to a group of our friends at the same time we are sharing it with one another.
I am not going to go into details of the technology that makes BitTorrent work. Rather, I want to give an illustration of the concept of BitTorrent and why it works so well.
Let's say I wrote a 300 page book that I want to share with 10 friends. Each one wants a copy, but for me to make 10 copies would take a long time. I could make 1 copy and give it to 1 friend. He could in turn make another copy from his while I was making another copy. At the end we would have 4 copies. We could give those out and make more copies. This would be at least twice as fast. If there were a larger number of friends who wanted the book then the exponential growth of everyone making a new copy once they received theirs would make the process more than twice as fast than me doing all the copies by myself.
Another way to achieve even faster distribution of the book is to divid the book into 10 different sections. I could then distribute one section to each of my friends and they could make a copy of their portion for themselves. They could trade around each of the 10 sections until they had made their own copy of the book. Or, they could make 10 copies of their section of the book and then distribute those around to the others. Either way, this would be 10 times faster than me making 10 copies and distributing them all by myself.
But, what happens when some of my friends have faster copiers than others? We might all be waiting for the same 30 page section from the beginning of the book. No one could start reading until the person on the slow machine finished making his copies to distribute. Or worse, what if one of my friends goes on vacation and forgets to make a copy of his section before he leaves?
BitTorrent would handle this situation in a much more elegant manner. By using trackers, seeds and peers BitTorrent is able to speed up the process even more.
This is how to make a copy of my book using BitTorrent.
I have a full copy of the book. Alice and Bob request part of the book to start making copies. I give Alice one part of the book and Bob gets another part. They each make copies for themselves and each other with plans to come back and get another section of the book as soon as they are done.
In the language of the BitTorrent protocol, I am the seed for the book. I have the complete book ready to give out to whoever needs it. Alice and Bob are both peers. They each only have part of the book, but are willing to share what they have while requesting more pages. Bob can't get any more of the book unless he shares with Alice. This keeps Bob from becoming a leecher. Getting new pages is dependent on him giving pages to Alice.
When Bob and Alice need a new section of the book, they can come ask me, or ask one another to see who has which portion. That is not so hard when you only have 3 people. But when you get 10 or 200 people involved in sharing the book, someone needs to keep track of who has which portion. Since I am the seed (the one with the whole book) and I know who has which portions (the peers), I can keep track of that so that when Bob asks for page 3, I can tell him that Alice has it. Or, if I am not busy, I can give it to him myself. This is the tracker in the BitTorrent protocol.
Our friend Carol hears about the book and wants a copy too. I give her another section of the book, while Alice and Bob make an extra copy of what they have to give to Carol. As time goes on, Alice ends up with a full copy of the book first along with my full copy. Now Alice is a seed along with me. When Dave wants a copy of the book, he comes to me (the tracker) and asks where he can get started. I decide that he can get a portion to start copying from either Alice or me. Alice's machine is faster, so I tell him to get it from her. Carol already has a couple of sections copied and ready to hand out, so Dave grabs some from her as well.
Then there is Eve. She is the one who got part of the book to start copying, but went on vacation before she could get a copy to everyone else. With BitTorrent, it does not matter that she has part of the book and not the whole thing. There are other full copies available in our network of friends and she can resume getting her copy of the book when she returns.
Each of my friends jump in and start making random copies of the book from whatever section is available at the moment, it allows slower copy machines to help to the whole project as well as those who have faster machines.
In the end, all the pages get reassembled into a book. Each friend has a copy and has helped distribute the whole book, bit by bit. While this may not have been any faster than 10 copy machines going at one time, it eliminates the bottle-neck that happens when one machine is considerably slower, or when a person goes on vacation. Yet those vacationers and slower machines can still contribute to the project on a time table that works for them.
This is an analog representation of the way BitTorrent works. It is a pretty fast way to distribute a book if the tracker (me) was able to keep up with all of the parts and who had which sections, the peers. When you consider that each computer can make an instant copy, you can see where this is a much faster way to distribute a file.
The copy can be made instantly, but the delivery takes time. You are limited by bandwidth, both up and down, to distribute the file fragments. By getting a file fragment from one of the machines that has it, but currently not transferring to someone else, we can eliminate some of the speed issues in delivery. Proximity from one machine to another can also cause the file transfer to go more quickly. If the tracker knows that 2 people are sitting in the same room working off the same internal network, it will instruct them to trade all the information they have between them instead of getting it off of the slower Internet.
BitTorrent allows every downloader to become an uploader.
Now that you understand the theory of how BitTorrent works, be sure to read a real-world example of using BitTorrent within a corporation.