qBittorrent icon indicating copy to clipboard operation
qBittorrent copied to clipboard

qbittorrent-nox upload/download speed reduces after some time of activity

Open S-trace opened this issue 3 years ago • 2 comments

qBittorrent version and Operating System

qBittorrent v4.3.3, Ubuntu Focal ARM64 qBittorrent is installed from an official PPA: deb http://ppa.launchpad.net/qbittorrent-team/qbittorrent-stable/ubuntu focal main

If on linux, libtorrent-rasterbar and Qt version

libtorrent-rasterbar10 1.2.12+git20210118.3efdb8a941-1ppa1~20.04 libqt5core5a 5.12.8+dfsg-0ubuntu1

What is the problem

After some active time (~30 minutes) qbittorrent-nox significantly reduces its upload and download speed (i.e. it can start the download on ~1.5 MB/s speed, and after some time the speed goes down and stabilizes at ~300..400 KB/s, and then stay at this level.

What is the expected behavior

Constant stable speed limited only by the connection speed.

Steps to reproduce

Run qbittorrent-nox and start downloading any popular torrent with many seeds. Wait a bit (~30..60 seconds) to let the download speed settle, notice it. Wait more time (~30..60 minutes) and check the current download speed (it will be significantly lower than at the start).

Extra info(if any)

I'm using qbittorrent-nox on a Khadas VIM2 V1.2 board, forwarding its traffic to the OpenVPN connection using a secondary routing table that has only a default route to the VPN gateway. I have set the following parameters to force qbittorrent-nox to use only the VPN for peers connectivity and prevent traffic leaks to the ISP:

Connection\Interface=tun0
Connection\InterfaceAddress=10.8.0.2

If I perform any changes on the tun0 interface - the speed is increased back to ~1.5 MB/s for some time, and then drops again after some time. For example, to do this I can add an IP address to the tun0 interface and then remove it immediately:

ip a add 10.8.0.3/24 dev tun0; ip a del 10.8.0.3/24 dev tun0

After running the commands above, I can see the following messages in qbittorrent.log:

(I) 2021-03-07T20:41:21 - Network configuration of tun0 has changed, refreshing session binding
(I) 2021-03-07T20:41:21 - Trying to listen on: 10.8.0.2:62012

The same behavior is observed on uploading torrents too (but it's not as clear as downloading the popular torrent because I can't control seeding speed) - after adding and removing an IP address to the tun0 interface upload speed increases for some time, just like for download.

Could you please give me any recommendations on how can I debug this behavior and then fix it?

S-trace avatar Mar 07 '21 17:03 S-trace

Here is an (almost) complete qBittorrent.conf (I have removed several privacy-related lines only, like an username/password). qBittorrent.conf.txt

Related to my traffic flows setup:

I have added a line to /etc/iproute2/rt_tables file:

200 isp2

Then I have set up this secondary route table using the following commands:

ip rule add from 10.8.0.2 table isp2 prio 1
ip route add default via 10.8.0.1 dev tun0 table isp2

Now the ip rule output has the following line:

1:      from 10.8.0.2 uidrange 0-0 lookup isp2

And here is an actual routing table printed by ip route show table isp2:

default via 10.8.0.1 dev tun0

According to the top command output, qbittorrent-nox consumes 30..40% of a single CPU core on an 8-cores CPU. According to free command output the OS has ~1 GB of free RAM. So this doesn't seem to be caused by the OS resource exhaustion.

S-trace avatar Mar 07 '21 18:03 S-trace

Created a https://github.com/qbittorrent/qBittorrent/wiki/Howto:-Linux:-qBittorrent-and-the-VPN wiki page with a detailed description of my setup to forward qbittorrent-nox peers connection traffic through a VPN.

S-trace avatar Mar 07 '21 23:03 S-trace