[bittorrent] Introductory/endgame algorithms

Andreas Aardal Hanssen bittorrent at andreas.hanssen.name
Fri Sep 23 04:55:48 EDT 2005

On Fri, 23 Sep 2005, Olaf van der Spek wrote:
>On 9/23/05, Andreas Aardal Hanssen <bittorrent at andreas.hanssen.name> wrote:
>> The warming-up algorithm I've got is that all connections download the
>> same piece initially, so that the client gets a full piece to share as
>> soon as possible. This works quite well, and currently they're all asking
>> for one piece. Do anyone on this list implement a similar algorithm?
>XBT Client does the same by preferring partially downloaded pieces
>when less than four (4) pieces have been completed.
>How do you choose the initial piece though?

I choose one by random, and always among the ones least seldomly (uh, most
often) available. I could choose more than one to minimize the risk of
starvation, but one piece seems to work fine so far ;-).

>> Also, what do other clients use to determine when to enter the endgame
>> mode?
>It depends on how exactly you implement end-mode, but I'd think a good
>starting point is if all chunks/pieces have already been requested.

That does sound like a good approach. I have seen serious trashing when
I've got something like 100+ connections downloading the same piece, but
solved that problem by randomizing the blocks I download in warmup/endgame
mode. Tests show that one peer usually gives me everything fairly quickly,
but when several are giving me the same pieces concurrently, randomness
ensures that I get one full piece with only about 3-4x overhead. This
works very well for warming up also.


Andreas Aardal Hanssen

More information about the BitTorrent mailing list