qbittorrent / qBittorrent

qBittorrent BitTorrent client
https://www.qbittorrent.org
Other
27.58k stars 3.91k forks source link

Download/upload speed decreases when qBittorrent is minimized, in background or out of focus. #14594

Open scapehips opened 3 years ago

scapehips commented 3 years ago

### qBittorrent version and Operating System v4.3.3 (64-bit) Windows 10 20H2 19042.870

10.0.19042

### What is the problem I have noticed many times that the dl and up speed goes down when qBittorrent is not in focus, i.e. when other windows are in focus. Important thing to note is that it does not seem to slow down when the other application window that I've selected, is not in maximized mode. I swear it happens everytime I minimize qBittorrent, or select any other window (maximized).

This issue is not torrent specific, I think it has happened with every torrent in the past. I have none other things going on that would consume high internet data on my computer. I always use qBittorrent in maximized mode.

### Extra info I opened this issue right after the download speed of the only active torrent went from 13 MB/s to 3 MB/s when I opened the browser for.... browsing. This torrent has 54 seeds (3 total) and around 220 peers. There is no download or upload limit. Gave qBittorrent Normal priority but the issue still exists.

xavier2k6 commented 3 years ago

It may be some QoS Quality of Service setting being used on your system...

samuk190 commented 3 years ago

I have the same problem

zinemaniac commented 3 years ago

This video might have a solution for you in case it's QoS.

https://youtu.be/7u1miYJmJ_4

q-DOESNOT-beat-torrent commented 3 years ago

This video might have a solution for you in case it's QoS.

https://youtu.be/7u1miYJmJ_4

Seems this is the root of the problem. I'm tired of when qbit is not the active window, speed can decrease times. Not always, but its systematically appearance noticed too. Though, this is actual and for browser downloading (if you use quite fast download servers like mega or just a lucky owner of a premium account.)

Well, who reconsidered Win settings according to the Youtube descriptions? Worked?

DarthGigi commented 1 year ago

Having the same issue on macOS 13.3 (22E252) (Intel) and qBittorrent v4.5.2 (64-bit) (Installed with homebrew)

When in focus, my download speeds are very high. But when minimizing or switching to another application (qBittorrent is out of focus), it slowly declines to less than 1MiB/s over the span of half a minute or so.

lwouis commented 1 year ago

Same here on macOS 13.2.1 and qBittorrent 4.5.2 (lt1 not lt2).

Here is an example where the flat section happens a few minutes after qBittorrent is minimized, and stops after I un-minimize the window:

image
glassez commented 1 year ago

I don't think it is purposely implemented by qBittorrent. Maybe it's some "cool feature" of macOS?

lwouis commented 1 year ago

I'm not aware of a built-in mechanic of macOS that would do this. I checked the nice value through htop, and it didn't change after I minimized the window, though the traffic dropped instantly:

image

@glassez I would actually suspect that qBittorrent reacts to being minimized and tries to reduce resource consumption or something like this, resulting in a performance drop.

I suspect specifically it could be a timer that changes somewhere. Maybe RefreshInterval because of some optimization trying to not compute things if the window is not showing.

growly commented 1 year ago

I have this problem on macOS 13.0 with qBittorrent v4.5.3. At first I thought I was imagining things, but the effect is clear and readily reproducible. The difference between watching qBittorrent and letting it work in the background seems to be 10x-100x throughput. I think I'm seeing this whenever the qBittorrent ends up in an unfocused workspace or when the machine turns the screen off (locking as it does). If I leave it peaking out from behind another window on my active workspace, throughput seems to remain high. Hopefully 10fc58a is the fix!

image

(screenshot is from 4.5.2)

ballo commented 1 year ago

Any work-around, yet? renice -20?

Andrey-Svetlichny commented 1 year ago

Same problem, v-4.5.5

luzpaz commented 1 year ago

@lwouis any progress on your experimental branch ?

lwouis commented 1 year ago

Hi @luzpaz,

I don't remember what that branch led to, back then. I think i tried a quick change, and it didn't show results. I think if i had something, i would have opened a PR to share the fix.

Thank you

RoLex commented 1 year ago

Some clues related to Windows 10 22H2 in my case, when files are preallocated for the first time.

Lets say I download a single 50GB file - Windows will perform operations on that file at the very beginning, honestly I don't know what type of operations - indexing, shadow copy, caching, defender scanner or similar (to get detailed information you need to use ProcMon). Until Windows is done with that file - the speeds will drop to paused state sometimes, once these operations are complete - the file will download stable all the way till the end.

Same thing if I download two 50GB files at the same time - it will take twice the time to get into stable download speed. Even tested with four 50GB files at the same time - the time to get stable speed will be multiplied by four, simply until Windows is done with these files.

My tests were performed on a brand new zero-formatted 8TB 5400 RPM non context-indexed secondary HDD. Next step will be disabling the preallocation and see what happens, and step after that is to run ProcMon and actually see what is disturbing the file write operation.

I even performed another test inside Windows - copied a 50GB file from one location to another on same HDD - I can actually hear Windows keep accessing that file for 5-10 minutes after copy operation is complete. There are no other applications running or utilizing my HDD at that time, only Windows alone with Windows Security activated.

RusackN1 commented 3 months ago

still the issue whenever the window is not in focus, the speed drops by ~50% (macOS 14.5)

glassez commented 3 months ago

still the issue whenever the window is not in focus, the speed drops by ~50% (macOS 14.5)

macOS knows better what's best for you 😄