[bittorrent] what is bitTorrent piece download mechanism?

Alan McGovern alan.mcgovern at gmail.com
Fri Mar 7 07:34:58 EST 2008


i left comments inline:

> What understood is
> 1. Peer contacts tracker to get its peer list.


> 2. Peer selects "which piece to download?" based on rarest first policy.


(except for first 4 packets.)

That isn't in the specification, but some clients could download the first 4
pieces first to allow for previewing video/mp3 files.

> I have following questions:
> 1. *(A)* Whether this entire piece is requested for download only from one
> remote peer  ;
> or *(B)* does it send multiple requests to different  remote peers (in
> case if that piece is available with more than one)?
> --> (I think it should request multiple remote peers to have better
> performance but not sure about what actually happens?)

That's implementation dependent. You can even get a mix of both of these
behaviours. Some clients might do (B) but switch to (A) if the piece ends up
being corrupt. This way they can find which peer is sending the bad data.

> 2. Is there any standard algorithm to decide "which block should be
> requested from which remote peer?"

Nope. It doesn't really matter. It's implementation dependent again. This is
only relevant if you do (B).

> 3. Suppose  peer requests remote peer for a particular block; and then
> remote peer chokes that request.
> Then does this peer request this block to some other peer? Is there any
> time-out limit for that?

Implementation dependent again. Some clients may drop all partial data when
a  peer chokes. Some may retain that data and continue downloading off
another peer. Clients who do (A) may drop the data, whereas clients who do
(B) would continue downloading as normal.

> 4. In general (excluding the case of end-game) does peer requests for one
> block to multiple remote peers ?

No. In general each block is requested exactly once. The only time a second
request would be sent out is if the peer you requested the block off choked
you, or sent a reject request message.

> 5. Can we initiate requests for some other piece before the download of
> the current piece is finished?

>  (i.e. during the time when all requests for currently chosen piece are
> made; but those requests are still being processed.)

Of course. Otherwise things would be incredibly slow, especially if you did

Hope that helps,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ibiblio.org/pipermail/bittorrent/attachments/20080307/59b49250/attachment.html 

More information about the BitTorrent mailing list