Well, lets take a sneak peek under the hood of your BitTorrent client, and list a couple of features that make BitTorrent as fast, stable, and robust as it is.
How it all Starts
BitTorrent starts with chopping a file into small pieces, the person who starts sharing the file (initial seed) sends those small pieces to available peers in the swarm. The BitTorrent protocol makes sure that the seed sends a unique piece to everyone, so they can immediately exchange these pieces with each other.
Thus, the great advantage is that everyone starts sharing pieces of the file right away.
Fair trading
Once you have a little piece of the file, your BitTorrent client tries to find other people who might be interested in the pieces you have. The BitTorrent protocol works as a tit-for-tat game, you only upload pieces to people who offer something to you. The more you upload to others, the more you receive.
This fair trading principle prevents free-riders from stealing your precious bandwidth.
Once you’re trading pieces with someone, the BitTorrent client keeps a close eye on this peer, as soon as the other side stops sending you data it will stop sending as well (choke). In the meantime, your client keeps searching for other peers It randomly sends data to peers who are interested (optimistic unchoke) to see if that peer is a potential trading partner.
Selecting pieces
So what pieces does your client sent first? Well, BitTorrent works with a “rarest piece first” scheme. Your BitTorrent client generally looks for the rarest piece that’s available among the peers in the swarm. This makes sure that the most common pieces are still available at the end and may prevent people from getting stuck at 99%.
Seeders & New Peers
Seeders don’t stop sending out pieces of course, but the rules change a bit. As a downloader the client determines the best peer by the upload/download ratio. A seeder however is only interested in peers with a high upload speed, so these fast uploaders can send the pieces to other peers, and speed up the overall speed of the swarm (seeds + peers).
New peers (without pieces) are more likely to receive a piece of the file at random. Besides this, new peers are not bound to the rarest piece first restriction. This makes sure that a new peer receives a “piece” as quick as possible, so he can share it with others.
No comments:
Post a Comment