Fenux.Net - The Life of a Geek
How BitTorrent Works
Fscking Computers!
Posted on 2/24/2007 12:09 pm in Fscking Computers!

Earlier today, I was finally catching up on reading Coding Horror. I've been behind on a lot of things, but that's another story. I came across an interesting artcile on BitTorrent.

The traditional method of distributing large files is to put them on a central server. Each client then downloads the file directly from the server. It's a gratifyingly simple approach, but it doesn't scale. For every download, the server consumes bandwidth equal to the size of the file. You probably don't have enough bandwidth to serve a large file to a large audience, and even if you did, your bandwidth bill would go through the roof. The larger the file, the larger the audience, the worse your bandwidth problem gets. It's a popularity tax.

With BitTorrent, you also start by placing your large file on a central server. But once the downloading begins, something magical happens: as clients download the file, they share whatever parts of the file they have with each other. Clients can opportunistically connect with any other client to obtain multiple parts of the file at once. And it scales perfectly: as file size and audience size increases, the bandwidth of the BitTorrent distribution network also increases. Your server does less and less work with each connected client. It's an elegant, egalitarian way of sharing large files with large audiences.

The part that really made me "oooh" and "aaaah" was the link to some source code for a visualization of how BitTorrent works. There's an animated gif in the article that shows part of it, but it really doesn't do the visualization justice. To remedy that, I've uploaded the java applet with the visualization so it can be seen in all it's glory.

©2009, Jason Burgess
All Rights Reserved