Friday, May 27, 2011

Legal Uses of the BitTorrent Protocol: Part 1

You may have heard of bittorrent and associated it with illegal movie and music downloading.  While admittedly, the bittorrent protocol is mainly used for nefarious purposes, it occurred to me a long time ago that there had to be a legal use for it.  Then it hit me, the main purpose of the bittorrent protocol is to efficiently move one file from one place to many other places.  I manage a set of servers that run a third party software package that gets updated several times a year.  These updates are difficult to distribute because 1) they are fairly large (100-750MB) and 2) I have to distribute the same file or group of files to all my servers.  In steps bittorrent. 

How does bittorrent work?
Think of bittorrent as organized ants eating your sandwich while out for a lovely picnic.   Their ultimate goal is to get the sandwich to the anthill.  So, they break the sandwich up into very small pieces and each ant takes one back to the anthill.  The more ants, the faster the job gets done.  Now, imagine there are 15 anthills that want your sandwich.  (Also imagine the ants have an advanced piece of technology that duplicates small pieces of your sandwich).  With all these anthills trying to get your sandwich and given their duplication technology, each anthill would have a copy of your sandwich within short order.  Now imagine there's a huge ant with a radio.  You let him know that you have a sandwich to share with the ants.  Each anthill asks this ant where the sandwiches are and they get started.
Torrents work the same way.  You have a big file (the sandwich) that you want to distribute to a bunch of destinations (anthills).  You create a file called a torrent file (file extension *.torrent) and announce it to a tracker (the ant with the radio).  Then you email the *.torrent file (a very small file by the way) to the various destinations (anthills) who then open the torrent with their favorite bittorrent client.  The torrent file instructs the client to go to the tracker (the big ant with the radio) and get a list of the sources (or seeders) of the file, aka you.  The ants descend on your file and begin to take back copies of very small chunks of your file.  None of this is very novel (in fact it's quite similar to napster if you remember).  The cool thing is that once an anthill begins to participate in the torrent, the tracker (the big ant with the radio) is notified who then lets all the other anthills know.  From the point of view of one of the anthills, there is a big sandwich out there.  There are also 14 other anthills with part (or soon all) of the sandwich.  The anthills begin to trade with each other.  The more anthills involved, the larger the swarm, the more quickly the file is distributed.  Cool, huh?