Author Topic: Limit upload speed when downloading speed over a threshold  (Read 1707 times)

adriantc

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Limit upload speed when downloading speed over a threshold
« on: October 25, 2016, 01:54:44 pm »
Hello. I would like to propose one nice addition to this already great piece of software, a feature that should be pretty easy to implement and is very useful for me (and probably for many others). I would like to have an option (just like uTorrent has) to limit the upload speed based on the download speed (with a configurable threshold). For example when I download with over 8Mbps engage the alternative speed limit and when the download speed drops below 8Mbps disengage it. I mostly seed, but when I do leech I would like to use full bandwidth as I noticed seeding and leaching at the same time comes with a huge speed drop. The feature can use the alternative limit or any new user defined limit (probably more complicated and not really more useful to me).
« Last Edit: October 25, 2016, 02:17:53 pm by adriantc »

Switeck

  • Forum addict
  • ****
  • Posts: 1475
  • Karma: +94/-0
    • View Profile
Re: Limit upload speed when downloading speed over a threshold
« Reply #1 on: October 25, 2016, 11:59:10 pm »
qBitTorrent can do proportional backoff using "Apply rate limit to transport overhead" (under Options, Speed, Rate Limit Settings).
Then when you're downloading quickly, upload speed should be decreased enough to keep things running smoothly.

You might even want to raise upload speed limit slightly (about 5-10%) to include the overheads you were already getting.

adriantc

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Limit upload speed when downloading speed over a threshold
« Reply #2 on: October 26, 2016, 05:17:38 am »
Thank you very much for that. I didn't know that it refers to that. Will it limit upload overall or only the overhead? (because uTorrent has a dedicated checkbox for limiting upload when downloading) And do you have any idea what that overhead is when downloading with for example 30-40 MB/s (usually more around 25 MB/s)? Right now I have the upload limit set to 64 kB/s). When you say 5-10% you mean the upload overhead is 5-10% of the download?

My exact scenario would be: normally uploading with say 10MB/s. Doing a download... upload gets limited to 128kB/s (or whatever value includes the overhead). When the download finishes the upload limit is removed and upload can climb back to 10MB/s.

PS: One more thing I did not mention. The download is affected by the upload not because of the bandwidth, but because of the HDD (which is an external one.. 2,5" on USB 3.0) which I guess cannot keep up with writing at 30 MB/s and reading at 10MB/s at the same time. Or at least that is my guess as I know upload and download speeds should be separate.
« Last Edit: October 26, 2016, 05:50:48 am by adriantc »

Switeck

  • Forum addict
  • ****
  • Posts: 1475
  • Karma: +94/-0
    • View Profile
Re: Limit upload speed when downloading speed over a threshold
« Reply #3 on: October 26, 2016, 09:52:34 am »
Yes, the external 2.5" HDD is most likely the speed bottleneck.
Set qBT's cache larger -- but no higher than 1000 MB. And longer -- for 600 seconds (the max currently allowed).

Overheads can be estimated by reading about TCP/IP networking overheads which BitTorrent is mostly based on. (uTP can get a little weird because it may use variable packet size.)
When downloading at 1000 KB/sec (roughly 1 MB/sec), I'd expect there to be ~50-100 KB/sec overhead on the download side AND ~50-100 KB/sec overhead on the upload side for SYN-ACKs and BitTorrent  messages (HAVEs, piece requests, PEX, DHT, tracker updates, etc). This is with no torrent uploading going on and half open connections and outgoing connection attempt rate set to 20 or less. (Those may not throttle back until qBT nears/hits connection max!)

So 30-40 MB/sec DL speed might incur 30-40 times my estimates for 1 MB/sec DL speed. (About 1.5-4 MB/sec overheads for down and up.) Overheads can actually be considerably better or worse depending on how quickly and how many connections qBT is trying to make as well as if there are especially aggressive peers/seeds (retrying your connection a few times per second despite already being connected) on the same torrents.

Considering so much is variable, forcing the total upload activities to limit themselves to qBT's upload speed limit makes quite a bit of sense instead of trying to guess how much upload is used.

If you're lowering your upload speed immensely while downloading, upload slots also need to be limited to keep things sensible. 100 global upload slots at 10 MB/sec gives them about 100 KB/sec each. But lowering upload speeds to 128 KB/sec might still try to split that 100 ways. :(

adriantc

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Limit upload speed when downloading speed over a threshold
« Reply #4 on: October 26, 2016, 10:08:40 am »
Thanks for being so informative.

Currently I have the 64 bit build (as I noticed the 32 bit build crashed on very high upload speeds). Currently the cache is set to Auto. So should I set it to manual to 1GB? RAM is no issue to me (I have a dedicated machine as a media server / seedbox with 8GB RAM). I would rather use more RAM then the slow external HDD. I have set the time limit to 600s (I can already see much less disk overload and more cache use)

So considering my usual maximum download speed setting an alternative limit of 2-3MB/s should be enough? And of course "Apply rate limit to transport overhead" enabled.

Switeck

  • Forum addict
  • ****
  • Posts: 1475
  • Karma: +94/-0
    • View Profile
Re: Limit upload speed when downloading speed over a threshold
« Reply #5 on: October 26, 2016, 01:45:54 pm »
The 32 bit build crashed on you probably because of the cache overrun bug which pushes its usage over 2 GB ram:
https://qbforums.shiki.hu/index.php/topic,3743.msg19531.html#msg19531

"So considering my usual maximum download speed setting an alternative limit of 2-3MB/s should be enough? And of course "Apply rate limit to transport overhead" enabled."

No, rather the opposite. If qBT's cache can cover for most of the disk overloads, lowering upload speed any may be unnecessary so long as "Apply rate limit to transport overhead" is enabled.
On the other hand, lowering the upload speed alone won't do any good if the disk is completely overloading.

Try setting a download speed limit of 20 MB/sec with "Apply rate limit to transport overhead" enabled along with a 1 GB qBT cache (with 600 seconds duration) to see if things run smoothly.