Connections Limits Understanding (Urgent Help needed!!)

Windows specific questions, problems.
Post Reply
Rando839

Connections Limits Understanding (Urgent Help needed!!)

Post by Rando839 »

Hello everyone,

I'm new to downloading torrents and would like to seek help understanding how exactly Connections Limits work in detail (if possible)?

Global maximum # of connections: sets the maximum number of peers to connect to for all torrents
Maximum # of connections per torrent: sets the maximum number of peers to connect to for each torrent
Global maximum # of upload slots: sets the maximum number of upload slots (basically the number of peers you connect to) for all torrents
Maximum # of upload slots: sets the maximum of upload slots for each torrent

I know the above settings exist but I can't really tell the difference btw global and non-global.
How does each of them affects my download speed when I'm downloading a torrent?

Initially I set both global max # of connections & max # of connections per torrent to be the same value as I do not really know the difference (or at least how setting both to be of different values would make a difference in download speed).
And I thought that the more number of connections I have = faster download speed.

But when I tried increasing the values, sometimes the download speed doesn't increase at all and that baffles me.

So I would like to understand how exactly these work and affect my download speed.

Also, does the upload slots settings play a part in my download speed when I'm downloading?
If so, why? I know that tit-for-tat principle exists and I read somewhere that the more I upload, the faster download speed I have?? But I don't think I'm uploading anything while downloading right? (I would only start to upload once I have completed the download if my understanding is correct). So I don't really see how it'll affect my download speed.

A very lost person here, would greatly appreciate the help!!

P.S. I set my protocol to be TCP as I believe that downloads the fastest. So I'm really just purely trying to understand and work with Connections Limits right now.
Switeck

Re: Connections Limits Understanding (Urgent Help needed!!)

Post by Switeck »

If you set max connections per torrent the same as the global max...
When you have 1 or more really busy torrents and a few torrents that might only have 1-4 peers/seeds, then the really busy torrents can "eat up" all the connections and leave nothing for the other torrents.

Unless you can download faster than 100 MEGABYTES/second, it's almost pointless to have more than 50 max connections per torrent while downloading OR more than 20 max connections per torrent while seeding.

Uploading too close to the max speed of your internet connection causes overload...which results in random packets (network traffic) to get lost. Sometimes those packets are important -- like trying to log into a website while qBitTorrent is running in the background. The login request (username + password) gets lost and it fails to log in.
Or YouTube videos freeze up and quit playing from time-to-time.
If it's torrent packets that get lost, the download and/or upload slows down immensely ...simply because it was overloaded for a fraction of a second.
This is why it's a good idea to set a max upload speed limit slightly lower than the real max upload speed of the connection.
Max download speed is usually much faster and not reached, so a max limit in qBitTorrent for download is normally not needed.

Uploading can only affect the torrent you're uploading on. The other torrents not only don't care, they're not even aware you're uploading elsewhere.

BUT...even beyond that, seeds (which already have all that torrent) that are uploading to you -- you can't give them anything (upload to them) so they don't have any direct means of "rewarding" your good behavior (uploading to others).

If you're uploading to a peer that just joined and had 0% complete...it has nothing to upload back to you, and thus you get nothing from it at least till it can download pieces from other peers or seeds.

A peer might upload to you if it has at least 1 piece of the same torrent that you don't have.
Even if it has pieces you don't have, it may not upload to you because it is instead uploading to other peers instead...or it may be set to not upload. (Usually, someone has to run a hacked, cheating BitTorrent client to do that.)

A peer tends to only upload to the 1-5 peers that are uploading the most to it. So uploading a little faster than other peers means you get more back from the few really fast peers you might be connected to. (This is where Tit-For-Tat kicks in -- upload speed is usually the greatest to peers that are giving qBitTorrent the most download speed.)

BitTorrent clients are programmed to upload to a limited number of peers at once, to prevent spreading their limited upload speed too thin -- this limit is called max upload slots per torrent (or global)
Dividing 100 KiloBYTES/second max upload speed between 1000 upload slots (global OR per torrent) is an extremely bad idea because each one will be too slow to be even remotely useful.

I recommend only 1 upload slot per 10 KiloBYTES/second max upload speed...so if 100 KiloBYTES/second is max upload speed, that works out to be only 10 global max upload slots.
You probably don't want to use all 10 upload slots on 1 torrent, so maybe set max upload slots per torrent to less than 10.

If you don't have enough upload slots to cover most of the fast peers on a busy torrent, you'll likely get slower download speed...because only the peers you're uploading to right now are likely to give you back anything on a continual basis.

Basically none of this matters if the torrents you download have 20+ seeds and 0-1 peer at a time...the seeds will upload to you and you don't have to give them anything back.

Limiting to TCP-only connections means uTP-only seeds and peers will not upload or download to your connection. On torrents with few seeds and peers, this can slow your download+upload speed to almost nothing...since most seeds and peers use uTP connections first and may only try TCP connections as a last resort.
Rando839

Re: Connections Limits Understanding (Urgent Help needed!!)

Post by Rando839 »

Switeck wrote: Mon Nov 01, 2021 6:06 pm If you set max connections per torrent the same as the global max...
When you have 1 or more really busy torrents and a few torrents that might only have 1-4 peers/seeds, then the really busy torrents can "eat up" all the connections and leave nothing for the other torrents.

Unless you can download faster than 100 MEGABYTES/second, it's almost pointless to have more than 50 max connections per torrent while downloading OR more than 20 max connections per torrent while seeding.

Uploading too close to the max speed of your internet connection causes overload...which results in random packets (network traffic) to get lost. Sometimes those packets are important -- like trying to log into a website while qBitTorrent is running in the background. The login request (username + password) gets lost and it fails to log in.
Or YouTube videos freeze up and quit playing from time-to-time.
If it's torrent packets that get lost, the download and/or upload slows down immensely ...simply because it was overloaded for a fraction of a second.
This is why it's a good idea to set a max upload speed limit slightly lower than the real max upload speed of the connection.
Max download speed is usually much faster and not reached, so a max limit in qBitTorrent for download is normally not needed.

Uploading can only affect the torrent you're uploading on. The other torrents not only don't care, they're not even aware you're uploading elsewhere.

BUT...even beyond that, seeds (which already have all that torrent) that are uploading to you -- you can't give them anything (upload to them) so they don't have any direct means of "rewarding" your good behavior (uploading to others).

If you're uploading to a peer that just joined and had 0% complete...it has nothing to upload back to you, and thus you get nothing from it at least till it can download pieces from other peers or seeds.

A peer might upload to you if it has at least 1 piece of the same torrent that you don't have.
Even if it has pieces you don't have, it may not upload to you because it is instead uploading to other peers instead...or it may be set to not upload. (Usually, someone has to run a hacked, cheating BitTorrent client to do that.)

A peer tends to only upload to the 1-5 peers that are uploading the most to it. So uploading a little faster than other peers means you get more back from the few really fast peers you might be connected to. (This is where Tit-For-Tat kicks in -- upload speed is usually the greatest to peers that are giving qBitTorrent the most download speed.)

BitTorrent clients are programmed to upload to a limited number of peers at once, to prevent spreading their limited upload speed too thin -- this limit is called max upload slots per torrent (or global)
Dividing 100 KiloBYTES/second max upload speed between 1000 upload slots (global OR per torrent) is an extremely bad idea because each one will be too slow to be even remotely useful.

I recommend only 1 upload slot per 10 KiloBYTES/second max upload speed...so if 100 KiloBYTES/second is max upload speed, that works out to be only 10 global max upload slots.
You probably don't want to use all 10 upload slots on 1 torrent, so maybe set max upload slots per torrent to less than 10.

If you don't have enough upload slots to cover most of the fast peers on a busy torrent, you'll likely get slower download speed...because only the peers you're uploading to right now are likely to give you back anything on a continual basis.

Basically none of this matters if the torrents you download have 20+ seeds and 0-1 peer at a time...the seeds will upload to you and you don't have to give them anything back.

Limiting to TCP-only connections means uTP-only seeds and peers will not upload or download to your connection. On torrents with few seeds and peers, this can slow your download+upload speed to almost nothing...since most seeds and peers use uTP connections first and may only try TCP connections as a last resort.
Hi Switeck,

I have to make a presentation on how the download speed of BitTorrent is affected by the connection limits settings so really appreciate the help you're giving here!! Thank you so much! I hope you can bear with me as I still have numerous clarifications to be made...

Currently, I am only experimenting with 1 public torrent.

(a) So I guess in this case, setting global max number of connections the same as max number of connections per torrent would not be an issue right? In fact, am I right to assume that global max number of connections should not matter in my case?

(b) Clarifying this point, can I then safely say that download speed does indeed increase as the number of connections increases? Since the more computers are involved in the swarm, the faster the file transfer occurs because there are more sources of each piece of the file.

(c) Next, on the topic of upload slots. From what you've said, if the torrent I download have more seeders than peers, the seeds will upload to me and I do not have to give anything back. Correct me if I am understanding it wrongly but does this means that in order for the number of upload slots to even matter, the torrent would need to have more peers than seeds?

(d) However, let's say there are 10 seeders and 20 peers. For me to upload to the other peers while downloading the same torrent, I would have to set my upload slots to above 10 otherwise I would only be uploading to these seeders which I actually do not have to since they are the seeders.

(e) If my understanding in [d] is correct, would this means that in that case of 10 seeds and 20 peers, increasing the number of upload slots may possibly increase my download speed as I could increase the chances that some of 20 peers would upload their pieces to me (on the basis that I am uploading a little faster than other peers)? Or is it actually rare for the number of upload slots to affect download speed positively?

(f) Then, when it comes to downloading public torrents, it would actually be close to 0 chance of me actually having to upload the torrent while downloading since such torrents would generally have tons of seeds and little peers right?
Switeck

Re: Connections Limits Understanding (Urgent Help needed!!)

Post by Switeck »

It is improper to completely quote the post right above yours, at least in its entirety. Bad enough people have to read my long post once. :P

(a) Max number of connections being equal for both per torrent and global would not be an issue unless both numbers were low, like 20 or less.
Even with only 1 torrent running, there are tracker updates, DHT connections, and even outgoing connection attempts (most of those fail) that might push against the connection max. An incoming connection may be blocked if max is already reached.

(b) Download speed increases only if the peers and seeds are fast themselves. Coupling more "dead horses" to the cart doesn't pull it faster. Peers will have nearly no reason to upload to your peer if your peer isn't also uploading to them. The fast peers won't uploa to your peer if your peer isn't uploading fast enough to them. Seeds, with their limited upload speed and limited upload slots are individually LESS likely to upload to you the more peers there are in the torrent swarm. Or say seeds DO upload to you...but they're uploading to ALL other peers as well -- then you get maybe 0.5 KB/sec from such spread-too-thin seeds!

(c) Yes, the seeds might upload to you but you can do nothing about it if they don't. For the upload slots to matter, there has to be peers able-and-willing to upload to your peer IF your peer uploads to them. If there's a lot of seeds and only a small number of peers, they might still try to upload a little to you...but they may download the torrent so fast they become a seed before you do.

(d) No, seeds are NOT uploaded to and are not counted as potential targets for upload slots. So with 10 upload slots, your peer would perhaps TRY to upload to 10 of the 20 peers...and should by Tit-For-Tat programming try to upload to the 10 peers that give the most back to your peer.

But there's another key thing to understand - you almost never have perfect vision of the torrent swarm. Some peers and seeds won't connect to your peer. They've already reached their connection max or they're firewalled so badly not much connects to them at all.
So if you connect to 10 seeds and 20 peers...there could be 5-20 more seeds+peers you won't connect with on the torrent. Also, trackers, DHT, and Peer Exchange report a lot of seeds and peers multiple times as well as many that have long since stopped running the torrent...they're not there anymore. So what appears to be a torrent with 100's of seeds+peers might be lucky to have 20 total that you can connect to on public torrents.

(e) 10 upload slots on a torrent swarm where you're connected to 20 peers means you'll probably connect to all the fast peers...but spread your upload a little thin and they may auto-decide they'll get more back uploading to other "faster" peers that are only uploading to 2-5 peers. (or maybe those peers are just faster as well) Like the old joke, you don't have to outrun the bear...just the guy next to you.

It is indeed rare for the number of upload slots or upload speed to matter much -- as many "popular" smaller torrents (under maybe 500 MB) have "sufficient" seeds to outnumber speed-wise what little you can get from the few brief peers.
But on 10+ GB sized public torrents that have maybe 1-4 seeds and 20+ peers...it is CRITICAL! Peers become seeds and often leave semi-quickly...and only a few diehard seeds (which are often slow, or too "giving" by trying to upload to everyone at once) keep the torrent alive so others might get it.

(f) Public torrents are a complete mixed bag:

Some on popular websites that are easy to find and have lots of peer+seed traffic will have little NEED for you to upload much as a peer.

OLD torrent/magnet links hosted on a seldom-visited website...might be impossible to complete.

Larger size torrents take so long that uploading a little to other peers effectively "speeds up" the entire swarm of peers so you can finish download a little faster...so long as new 0% complete peers aren't constantly joining. If new peers are constantly joining, what can happen is fast peers sort of "pair up" -- where they regularly upload to each other the parts the other one lacks...and they pull themselves along as though they're a single peer with combined parts and spare upload speeds to give to others.
I personally find on large torrents that it's a struggle to download as fast as I'm uploading, simply due to the lack of decent peers to share with...and most seeds give NOTHING on a per-hour basis.

It's complicated...because many peers only use IPv4 and likely won't connect to any peers/seeds that are firewalled on IPv4 but not IPv6, many only use uTP and won't connect to peers using TCP only, many are "hopelessly" firewalled and can only connect to peers/seeds that are NOT firewalled, some are requiring protocol encryption...and won't connect to those that have that disabled.
Post Reply