Jump to content

Piece and peer/seed selection algorithm


UberSletz0r

Recommended Posts

Yes, I know the client (generally) gets a list of 20 random addresses from the tracker.

But that's not something you can change in the client (next to DHT, peer exchange and requesting more peers from the tracker).

My question is what uTorrent does after receiving a list of peers.

The algorithm should however make a choice which addresses to connect to first (is this done randomly?), if pieces have the same availability (assuming rarest first), what piece is chosen? (also, randomly?) and if a choice is made, what peer will be requested to send the chosen piece?

I think there might be some room for (at least experimental) improvement. I notice I usually get higher up- and download rates with people within the network of my own ISP or people within my country. If for example connection attempts or piece requests where done based at ping times (latency), hop count (traceroute) or based on the country (DNSBL) you might get overall higher up and download rates.

Link to comment
Share on other sites

Although latency does not say much about the bandwidth (which essentially determines the speed limit), I think with small pieces/chunks the latency (which usually depends on the distance) indeed determines the speed.

The point I want to make, is that, especially with torrents with many peers and seeds (where you won't connect to them all), connecting to the closest peers (lowest latency) will improve the speed.

Next to that, requesting chunks/pieces at these same 'close' peers, might also have a performance benefit.

I wonder if this theory would work in practice, if someone has experience with this idea and if this might be interesting to implement in uTorrent. (hence I wonder what algorithm uTorrent currently uses)

Link to comment
Share on other sites

(...) connecting to the closest peers (lowest latency) will improve the speed.

Next to that, requesting chunks/pieces at these same 'close' peers, might also have a performance benefit.

If every peer had unlimited bandwidth to serve you, that statement would hold true. But peers are very much limited in bandwidth, are they not?

If you want the fastest speeds the best protocol should prioritize based on speed and not some other indirect variable. Peers that are close to you could be choked, could have low upload capacity, could be firewalled and not connectable, could have incorrect settings, ... The list of possibilities to screw up is virtually endless so latency is a poor criteria. In the end what matters is the results, that is, how much you are actually getting from that peer. And that is exactly what the protocol does with the choking/optimistic unchoking algorithm.

Link to comment
Share on other sites

[..]

If you want the fastest speeds the best protocol should prioritize based on speed and not some other indirect variable. Peers that are close to you could be choked, could have low upload capacity, could be firewalled and not connectable, could have incorrect settings, ... The list of possibilities to screw up is virtually endless so latency is a poor criteria. In the end what matters is the results, that is, how much you are actually getting from that peer. And that is exactly what the protocol does with the choking/optimistic unchoking algorithm.

But how can a client know what the speed of a peer is, if it's not connected to the peer and has downloaded something already. Of course the criterium should be speed, but what would give you a better chance to connect to a 'fast' peer in the first place?

With a large amount of peers, clients tend to connect to only a small part of them (due to an established connection limit, max half-open connections, which determines time to connect to them 'all' etc). Wouldn't it be 'more intelligent' to try to connect to peers that have a higher probability on obtaining good speeds?

Since nothing is known about the peers at start (choked, firewalled, settings etc), using an indirect variable might be better than just randomly connecting to them.

I just wonder what the current implementation is and if this 'idea' would be better.

Link to comment
Share on other sites

Randomly connects to them, and drops inactive peers (there's always inactive peers) after a few minutes (5 to be exact) so it can open up the connections for new ones. And really, ping means absolutely nothing, it's not any better than connecting randomly.

Link to comment
Share on other sites

  • 4 years later...

Back to the suggestion of choosing peers who are from same ISP, region or country...

How about specifying a preference network prefix list and let BT match it against the peer list. The prefix list could be user configurable in the BT client. Perhaps for a small region or even small country, there are only a handful of ISPs and each ISP typically have a small no. of summarized prefixes, so that this list would be small.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...