qBittorrent icon indicating copy to clipboard operation
qBittorrent copied to clipboard

Download Global Rate Limits not working (Continuation of #8433)

Open cab0oze opened this issue 4 years ago • 32 comments

Please provide the following information

qBittorrent version and Operating System

4.3.1 / Windows 7 64bit

What is the problem

Same issue as apparently has existed in the problem for years: https://github.com/qbittorrent/qBittorrent/issues/8433

What is the expected behavior

Upload speed is not limited to the global limits

Steps to reproduce

Open qbittorrent, ensure a rate limit is set. In my case it started exceeding the limits within ~20s as soon as connections were opened.

Extra info(if any)

Why was the other issue closed?!? https://github.com/qbittorrent/qBittorrent/issues/8433

I took some screenshots to prove that my settings were correct.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

cab0oze avatar Dec 11 '20 00:12 cab0oze

1 2

Note I don't have peer rates limited on my LAN, but there are also no other computers on my LAN at this time.

cab0oze avatar Dec 11 '20 00:12 cab0oze

Why was the other issue closed?!?

The reasons were clearly explained in the closing post: https://github.com/qbittorrent/qBittorrent/issues/8433#issuecomment-742706535.


That being said, thanks for posting with adequate information. 225 KiB/s is on the low side. If I set the limiter to that value and load up some torrents with a big swarm, I can see excursions up to 300 something as well. However, dips to lower speed compensate for that, such that over time, it seems (to my eye, nothing rigorous) to be averaging out to the desired value. This can been seen both in qBittorrent's built-in graph and some other network monitor such as Task Manager on Windows (I checked). With a higher limits the pattern is similar, but the spikes are relatively smaller, so it is not as noticeable.

Though I haven't looked at that code, his is almost for sure just a result at whatever method libtorrent uses to figure out the current rate and limit it. Some kind of averaging over time is going on, leading to this observed behavior (spikiness, leading to temporary (and limited) excursions to values higher than the set limit). Now, taking this into account, I can see why one would reach the conclusion that the bandwidth limits are not working - but as long as the average transferred data doesn't exceed what would have been transferred if transferring always at exactly the limit, it's working as intended.

@arvidn is my speculation reasonable? Do you mid elaborating a bit more on what happens exactly in the bandwidth limiter?

FranciscoPombal avatar Dec 11 '20 01:12 FranciscoPombal

Note: it can clearly be seen that despite the spikes, the bandwidth limiter will result in an average speed (check it in the General tab) pretty damn close to the value set in the limit. You can test it yourself easily by setting a limit, and adding a single completed torrent with many peers (so that once it starts, it immediately starts seeding up to the limit you set). After a while, the reported avg speed on the torrent will be very very close (within KiB/s) of the set limit.

Perhaps it would be better in terms of UX if there is a way to rate limit connections without using average transfer rate as a control. Something that doesn't generate such a spiky pattern, which leads users to think that the limits in the program are broken.

FranciscoPombal avatar Dec 11 '20 01:12 FranciscoPombal

It could be that, however the spikes over the limit (let's say 15-20% over on average) are literally every 2 seconds. To me that seems excessive, even if the average hits the mark - which I want to say it does.

My maximum upload speed is 375kB/s. To avoid running into download speed problems due to excessive upload, I applied some old rule of thumb of capping my max upload at 80% of that. This always worked for me in the past with other programs. However, now that I've switched to qBittorrent, if I set my max upload rate to that value (375 * 80%), it ends out maxing out my connection every 2-3 seconds and suddenly if I run a basic ping test the about half the pings time out. Because of this issue I've decreased my max upload to 60% of my max speed, and now the constant spikes no longer eat into that last 20% of upload capability and everything works fine with slower on average overall upload speeds. Personally I think something isn't working properly.

cab0oze avatar Dec 11 '20 01:12 cab0oze

Perhaps it would be better in terms of UX if there is a way to rate limit connections without using average transfer rate as a control. Something that doesn't generate such a spiky pattern, which leads users to think that the limits in the program are broken.

Not a bad idea, however I think something may actually wrong here and the UX is helping users see that. Please let me know if I made any poor assumptions in my latest post.

cab0oze avatar Dec 11 '20 01:12 cab0oze

@cab0oze Could you try selecting all your torrents in transfer list, right click & set "Limit upload rate" to that of your "global rate limit" of 225KiB?

How does that perform?

xavier2k6 avatar Dec 11 '20 01:12 xavier2k6

@cab0oze

Not a bad idea, however I think something may actually wrong here and the UX is helping users see that. Please let me know if I made any poor assumptions in my latest post.

I don't think anything is "wrong" here per se, I just claim that the characteristics of the current bandwidth limiter are not the best for the user, even though the final result in terms of average bandwidth usage over a period of time is "correct". I agree that for most users, a "less spiky" pattern is better, it's not just about the average speed over time. Let's see if anything can be done in libtorrent to address that, or if there is also something we can do on our side to help.

My maximum upload speed is 375kB/s. To avoid running into download speed problems due to excessive upload, I applied some old rule of thumb of capping my max upload at 80% of that. This always worked for me in the past with other programs.

If your router has good hardware and QoS you should be able to simply not bother with any kinds of limits at all.

@xavier2k6

@cab0oze Could you try selecting all your torrents in transfer list, right click & set "Limit upload rate" to that of your "global rate limit" of 225KiB?

How does that perform?

I don't think that's relevant. I can "reproduce" (in the sense that I see the excursions from the mean, but the average is still correct). Can't you?

FranciscoPombal avatar Dec 11 '20 02:12 FranciscoPombal

@cab0oze Could you try selecting all your torrents in transfer list, right click & set "Limit upload rate" to that of your "global rate limit" of 225KiB?

How does that perform?

~ The same. I usually don't

ur router has good hardware and QoS you

@cab0oze

Not a bad idea, however I think something may actually wrong here and the UX is helping users see that. Please let me know if I made any poor assumptions in my latest post.

I don't think anything is "wrong" here per se, I just claim that the characteristics of the current bandwidth limiter are not the best for the user, even though the final result in terms of average bandwidth usage over a period of time is "correct". I agree that for most users, a "less spiky" pattern is better, it's not just about the average speed over time. Let's see if anything can be done in libtorrent to address that, or if there is also something we can do on our side to help.

My maximum upload speed is 375kB/s. To avoid running into download speed problems due to excessive upload, I applied some old rule of thumb of capping my max upload at 80% of that. This always worked for me in the past with other programs.

If your router has good hardware and QoS you should be able to simply not bother with any kinds of limits at all.

@xavier2k6

@cab0oze Could you try selecting all your torrents in transfer list, right click & set "Limit upload rate" to that of your "global rate limit" of 225KiB? How does that perform?

I don't think that's relevant. I can "reproduce" (in the sense that I see the excursions from the mean, but the average is still correct). Can't you?

@xavier2k6 I tried that, no change. In fact while I was watching it, at one point it was 300, 280, 250, 215 (i.e. 3 full seconds) above the average before bombing down and hitting some equally low numbers.

@FranciscoPombal Everything is going through a VPN on this one PC in particular so my understanding is the router has zero say in terms of QOS. My mistake I guess would be doing everything through the VPN on a single PC, but that's just the setup I have to live with right now.

Also, thanks! I'm new and don't understand the libtorrent/qbittorrent relationship, but if you guys can dig into this I think there is potentially some room for improvement that could really help out a lot of users.

cab0oze avatar Dec 11 '20 02:12 cab0oze

I didnt see ticket so I posted a new one ( closed already). I was seeing Mb/s upload rate when global rate limit was set to KiB/s.

DTG123 avatar Mar 18 '21 21:03 DTG123

Adding my voice to this issue after going through the multiple threads on this issue. I'm trying to limit my download speeds to around 5 Mib/s but all torrents keep maxing out at over 10Mib/s. Tried everything above and in other threads, and I really don't believe that 5 Mib/s is "unreasonable" for downloading.

@FranciscoPombal, a few words after reading your replies both here and elsewhere over the years, maybe the problem stopped being a bug and started being a failure in user interface/experience since so many people keep seeming to post about this same issue. If this many people keep consistently having the same exact misunderstanding, then maybe its time you guys re-evaluate how it's set up in the software. Also, I'm not sure if I agree with you getting to decide what's an "unreasonable" up/download value and having the software just completely ignore numbers it deems "unreasonable," which leaves us to just trial and error then post on here consistently.

I understand it might not be an actual bug, but if it's this convoluted to get it set up properly then maybe we need a tutorial, a link to a wiki page in the settings page, or something that makes it easier for people to properly set up. Or a redesigned feature.

Because I've read just about everything and tried multiple fixes you and others have suggested, and I'm still at a loss. I also don't think I should be an expert level power user just to use a supposedly basic torrent speed limiting feature.

trebory6 avatar Mar 25 '21 05:03 trebory6

Of course this how all bugs work, I way playing around with it a bit yesterday and was going to do a full bug report today but I am no longer able to reproduce it. sorry I can't add much more.

qBittorrent version and Operating System qB = 4.3.5 64-bit OS = x64/Windows 10 19041.928

What is the problem The global UP/DL limit are not restricting the UP/DL rates. I set download to limit at 1MiB/s the torrent would download to max internet speed of about 8 to 9 MiB/s.

Workflow Clean install -> Set up limit as shown in the images above. Changing the global limits resulted in no download restrictions. Restart qBittorrent -> same result. quit qBittorrent and leave computer over night and try to make a detailed bug report -> fixes the issue.

What did work, as mention in the last thread, setting the individual torrents download limits did restrict the download rate to that amount. What I found is that if the individual torrent download limit is greater than the global limit, it would restrict the download to the torrent limit and still ignore the global limit.

I'm thinking maybe race condition as it is hard to reproduce and its seemingly "random". My other thought it is that since QBT uses a limit of zero to represent having no limit, could the global limit be getting dropped or set to zero in the back ground some how.

SingularityPotato avatar May 09 '21 03:05 SingularityPotato

I'm thinking maybe race condition as it is hard to reproduce and its seemingly "random". My other thought it is that since QBT uses a limit of zero to represent having no limit, could the global limit be getting dropped or set to zero in the back ground some how.

In an attempt to narrow down the triggering causes...some strange questions to ask:

  1. Did you verify that uTP and "LAN traffic" (sometimes misidentified as such) are set to limited as well?

  2. Are max allowed connections globally over 50 or per torrent over 20?

  3. Is there 1 torrent with 30+ connections at once which also tends to have the majority of the upload (and/or download) speeds?

  4. Is IPv6 and IPv4 connections both available? (I've heard maybe IPv6 wasn't being limited sometimes...but only if there's a mix of both.)

  5. Lastly, are you using a VPN or IPv6 tunnel broker (like TEREDO or 6to4)?

Seeker2 avatar May 09 '21 05:05 Seeker2

  1. yes, I even disabled and re-enabled them just to see if it was a UI bug.

  2. I left max connections as the default values, so max globally connections is 500 and max connections per torrent is 100.

  3. I only tested this with one torrent in the application (It was my first torrent since installing it). At the time I didn't look at how many connections were on the torrent but I redownloaded it today and it sits around 80 to 100 connections (the redownload does not have the issue.).

  4. Both IPv4 and IPv6 are enabled and when I view the "Peers" on the torrent I can see connections from both.

  5. I am not using a VPN or tunnel.

SingularityPotato avatar May 10 '21 00:05 SingularityPotato

As we can see from your screenshot, there is only about ~10% overshoot above your set limit. Can you post a screenshot with a graph of your upload rate over time (also with LAN traffic being limited, just in case) ? A +25KB/s or ~10% might be looked at as "acceptable overshoot" for a short time in qBT "eyes", or a simple math-calc bug in averaging the speed...

Here is how it looks here with 150KB/s limit, and increase # upload slots/torrent to 15: 1

... definitely looks like it is much better limited by uTorrent (no overhead being limited) , so you might consider replacing your client... ;P 2 2

rafi-d avatar May 13 '21 07:05 rafi-d

I just encountered this issue, and was suffering from it until literally two minutes ago...

I noticed that in my settings, I had:

qbittorrent_qrOYjxFCTQ

I then changed the "Rate Limit Settings", to include everything, and hit "Apply", so it looks like:

UXADzX1NQr

But it still didn't apply... Hmm... A restart maybe?

qbittorrent_nYESl36Hdk

Success!

So, it seems, at least in my case, that the settings need to be applied in the "Rate Limit Settings" checkboxes, but that hitting apply doesn't actually apply them until a full client restart occurs.

So there's a bug there, at least in client, 4.3.5, full details:

qbittorrent_lhywgG4L92

flatline-studios avatar Jun 20 '21 12:06 flatline-studios

Stopping and restarting all torrents that have connected peers (or seeds for downloading torrents) might also get the Download Global Rate Limits to take effect, as this should clear any DL+UL limits individual connected peers+seeds have.

This may be less harsh a workaround for the problem ...assuming this even helps.

Seeker2 avatar Jul 09 '21 22:07 Seeker2

Hi, just found this thread. I am using qbittorent since v4.3.2 (28 Dec 2020), and now at v4.3.6 (Windows 8 Pro En, x64).

According to my observations, qbittorent never respects upload limits. It always uploads at max speed. Here is a typical picture: clip

This is not a spike, the speed is persistent and real, and may be much higher. I think this is related to this “Download Global Rate Limits not working” issue.

grapvar avatar Aug 27 '21 22:08 grapvar

@grapvar in your pic it seems that the limit you set is respected except for 1 peer. Any chance that peer's ip is in any of these ranges? https://github.com/qbittorrent/qBittorrent/blob/b924357ea92c6ab17c951b298cd6f0b86db106fa/src/base/bittorrent/session.cpp#L1509

thalieht avatar Aug 28 '21 11:08 thalieht

Has this been fixed yet?

purevertigo avatar Sep 30 '21 07:09 purevertigo

Please provide the following information

qBittorrent version and Operating System 4.3.9 / Windows 11

What is the problem Same issue as: #8433

What is the expected behavior When setting global limits, they are not respected even after client restart.

Steps to reproduce Open qbittorrent, ensure a rate limit is set. Start download and watch it spike above the limit set.

Extra info(if any) Save folder is not on the OS HDD like another issue Running VPN (PIA) No IPV6 Had this issue prior to updating to windows 11 as well.

I took some screenshots to prove that my settings were correct. 2 1 qbittorrent.log

digidoggie18 avatar Dec 13 '21 02:12 digidoggie18

Have you disabled using of uTP by any chance? I hope not...

If not, your settings are "proved" wrong... "Apply limit to uTP" should be enabled, and "apply limit to overhead" - disabled.

With your setting - there is simply no speed limit set to UDP traffic!

rafi-d avatar Dec 13 '21 05:12 rafi-d

Actually my settings have been verified over and over. Prior to this I went through every post regarding this and tried every setting underneath global upload limits in every combination I possibly could. Checking apply to uTP does nothing for me as well because I do not use uTP protocol in this app  and haven't in decades. If thats the case, what would be a good way to set this up so this app isn't making the rest of my connection unusable? On Sunday, December 12, 2021, 10:11:38 PM MST, rafi-d @.***> wrote:

Have you disabled using of uTP by any chance? I hope not...

If not, your settings are "proved" wrong... "Apply limit to uTP" should be enabled, and "apply limit to overhead" - disabled.

With your setting - there is simply no speed limit set to UDP traffic!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

digidoggie18 avatar Dec 13 '21 14:12 digidoggie18

The [p2p] world is changing... It's time for you to enable uTP+TCP mode.

rafi-d avatar Dec 13 '21 14:12 rafi-d

@digidoggie18 your screenshot seems to demonstrate the rate limit working. Is there a chance you could average those rates over slightly larger time windows? by just squinting at that noisy rate, it doesn't look like it would average very far from 591 kiB/s.

In your mind, what is the rate averaging to? and how far away is that from the rate limit you've set?

arvidn avatar Dec 13 '21 14:12 arvidn

When I disabled in a long time ago, it was for privacy issues I believe, most of my settings try to revolve around that even with me not understanding some of them. Will this have an issue with that? 

Sent from Yahoo Mail on Android

On Mon, Dec 13, 2021 at 7:46, @.***> wrote:

The [p2p] world is changing... It time for you to enable uTP+TCP mode.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

digidoggie18 avatar Dec 13 '21 15:12 digidoggie18

No, but both enabled may give more connection options, so better overall performance. Plus, it has nothing to do with privacy....

rafi-d avatar Dec 13 '21 15:12 rafi-d

Plus, it has nothing to do with privacy....

It used to. in old versions of libtorrent, setting a proxy wouldn't necessarily use it, if it didn't support UDP for example (which seems pretty common among socks5 proxies). Then there was a force_proxy setting which would rather just fail all UDP packets than circumvent the proxy, and the current behavior is to just always use the proxy (whether it works or not) when one is configured.

arvidn avatar Dec 13 '21 15:12 arvidn

arvidn's comment is exactly why I disabled it originally. I do remember I had issues with proxy (back in like 2015ish). I have issues now as well though and have since about april to june timeframe. I believe that has to do with my VPN though and I currently have tickets submitted as the setting doesn't even work in their app settings.

I enabled it and at first my settings completely tanked and I couldn't connect. I double checked my ports were forwarded and restarted and it persisted. For some reason it just started working again maybe 5 mibs ago. Does anyone have a recommended guide for settings for Qbittorrent aimed at privacy and what works now? I have looked at guides but haven't seem a huge amount of changes among them which is typical.

digidoggie18 avatar Dec 13 '21 16:12 digidoggie18

Consider the default setting to start with, and re-check your "Download limit does not work" issue using ubuntu torrent... So, all privacy and VPN related [disable it!] issues can be ignored

rafi-d avatar Dec 13 '21 16:12 rafi-d

There is definitely a bug within this setting. I find if type a figure in say anything less than 2000 and click apply it does not work aka it still downloads at my full speed 3+MB/s even though I can see the change in the app at the bottom. Also if I up and down arrow away from 2000 and then back to it then click apply with Options still open it doesn't work either. However if I do the following a few times e.g. cancel out of Options, open it up again and up and down arrow again then click apply a few times it then appears to start working correctly. Hope this helps the devs. It appears to me at least typing in a figure breaks it.

Weedyapl avatar Jul 01 '22 00:07 Weedyapl