Page 1 of 2

Memory usage

Posted: Thu Dec 05, 2019 6:31 pm
by Weggy
Hi,

Im unsure if this is expected behaviour but, Deluge is using alot of memory.

I've got around 16 torrents downloading/seeding and Deluge is using 3+Gb of RAM on my VM which is grinding it to a hault from a RDP point of view. Is there a method of restricting this?

Many thanks again

Re: Memory usage

Posted: Thu Dec 05, 2019 11:00 pm
by mhertz
What's your cache setting? Also, if using thin client, is it mostly in deluge or deluged processes? Real memory usage, not just cached, right? Deluge version and OS - I'm guessing windows guest since you mention rdp? (Though rdp is available elsewhere too)

Sorry, besides if having caching enabled very high, then I don't really know much about this subject/issue honestly, and sound like a bug then, with that low amount of torrents.

Re: Memory usage

Posted: Fri Dec 06, 2019 10:40 pm
by Weggy
Memory appears to be assigned to Deluged. It's running on...
OS: Linux 4.15.0 - Ubuntu 18.04 LTS
Deluge 2.0.3-2-201906121747-ubuntu18.04.1
libtorrent: 1.1.5.0
Python: 3.6.9

Deluge cache settings...
Cache Size (16 KiB Blocks): 512
Cache Expiry (seconds):60

Annoyingly, now I'm not so sure this is the issue. As my memory is only now at 50% usage but performance on my VM is still poor when multiple torrents are running. Right now I'm at CPU usage 18%, processes: 77 Memory 57%. But the speed/performance of the RDP has dropped alot.

If I pause all torrents. CPU usage: drops to 5 - 15%, processes almost the same at 75 and memory is still at 57% so I must be on the wrong track. I guess its a network issue, but the bandwith on this VM is like a Gig, so that doesn't add up either.

Re: Memory usage

Posted: Fri Dec 06, 2019 11:08 pm
by mhertz
Hmm, yeah I'm affraid I don't know either, and just posted to suggest upgrading libtorrent, instead of the 2 years old version currently using. If using 3'rd party plugins, then disable them, and enable one at a time, to test if one of them is possibly the issue on your system. Hope you figure it out eventually.

Re: Memory usage

Posted: Fri Dec 06, 2019 11:10 pm
by Weggy
Here's a snapshot of htop with torrents running:

Image

Re: Memory usage

Posted: Mon Jun 28, 2021 9:13 am
by QWIKAG
Potential fix below...

So I had the same problem.
The reason I got into that state was this:
1. I upgraded to Ubuntu 20.4
2. Deluged stopped working.
3. Someone on some forum said upgrade deluged to v2.xxx, so I did
4. Deluge started working, but it was using a lot of memory, in fact all of my memory until CPU started maxing out, it required a shutdown. And immediately aftyer reboot RAM usage climbed quite quickly after a few minute 1G few more minutes 2G.

Other forum suggested upgrading libTorrent that it was the culprit, so I did, this made sense because I had upgraded Deluged.

So I was in the same state as above just with a newer libtorrent.

I uninstalled everything in doing so I made a mistake and lost a lot of applications causing an OS melt down.

The Fix:
At some point I must have uninstall libtorrent (it was a nightmare), many version of Deluge trying to use v2+ libtorrent
re-installed all deluge items from this page:
https://askubuntu.com/q/1184176/645203
installing all of the deluge components of this same version.
mkdir -p ~/Downloads/deluge
cd ~/Downloads/deluge
wget http://archive.ubuntu.com/ubuntu/pool/u ... _amd64.deb
wget http://archive.ubuntu.com/ubuntu/pool/u ... _amd64.deb
wget http://archive.ubuntu.com/ubuntu/pool/m ... _amd64.deb
wget http://archive.ubuntu.com/ubuntu/pool/u ... _amd64.deb
wget http://archive.ubuntu.com/ubuntu/pool/u ... -2_all.deb
wget http://security.ubuntu.com/ubuntu/pool/ ... .1_all.deb
wget http://security.ubuntu.com/ubuntu/pool/ ... _amd64.deb
wget http://archive.ubuntu.com/ubuntu/pool/m ... -3_all.deb
wget http://archive.ubuntu.com/ubuntu/pool/u ... _amd64.deb
wget http://archive.ubuntu.com/ubuntu/pool/u ... _amd64.deb
wget http://archive.ubuntu.com/ubuntu/pool/u ... _amd64.deb
wget http://archive.ubuntu.com/ubuntu/pool/u ... -2_all.deb
wget http://archive.ubuntu.com/ubuntu/pool/u ... -2_all.deb
wget http://archive.ubuntu.com/ubuntu/pool/u ... -2_all.deb
wget http://archive.ubuntu.com/ubuntu/pool/u ... -2_all.deb
wget http://archive.ubuntu.com/ubuntu/pool/u ... -2_all.deb
wget http://archive.ubuntu.com/ubuntu/pool/u ... -2_all.deb

sudo apt install ./*.deb

e.g.
now this is my versions and it is working perfectly. As good as ever before:
deluge: 1.3.15
libtorrent: 1.1.5.0

Going forwards:
only thing left to sort is my apt version of deluge-web is ready to upgrade, which I doubt i ever will after this debarcle.

deluge-common/now 1.3.15-2 all [installed,local]
deluge-console/now 1.3.15-2 all [installed,local]
deluge-gtk/now 1.3.15-2 all [installed,local]
deluge-web/focal,focal 2.0.3-2 all [upgradable from: 1.3.15-2] - I DONT LIKE THIS
deluge/now 1.3.15-2 all [installed,local]
deluged/now 1.3.15-2 all [installed,local]

I do not know if I am right to have installed this version.
But every single other forum did not give the full truth.
even this Deluge site does not tell how things are meant to be.

Hopefully this helps someone.


UPDATE:
I change this script and it should prevent upgrade
cat <<EOF | sudo tee /etc/apt/preferences.d/pin-deluge
Package: deluge
Pin: version 1.3.15-2
Pin-Priority: 1337

Package: deluge-common
Pin: version 1.3.15-2
Pin-Priority: 1337

Package: deluge-gtk
Pin: version 1.3.15-2
Pin-Priority: 1337

Package: deluged
Pin: version 1.3.15-2
Pin-Priority: 1337

Package: deluge-console
Pin: version 1.3.15-2
Pin-Priority: 1337

Package: deluge-web
Pin: version 1.3.15-2
Pin-Priority: 1337

Package: libtorrent-rasterbar9
Pin: version 1.1.5-1build1
Pin-Priority: 1337
EOF

=

deluge-common/now 1.3.15-2 all [installed,local]
deluge-console/now 1.3.15-2 all [installed,local]
deluge-gtk/now 1.3.15-2 all [installed,local]
deluge-web/now 1.3.15-2 all [installed,local]
deluge/now 1.3.15-2 all [installed,local]
deluged/now 1.3.15-2 all [installed,local]

Re: Memory usage

Posted: Mon Jun 28, 2021 9:21 am
by QWIKAG
BTW this could all just be a python issue. not a libtorrent issue, I have no idea.
mine seemingly does not return python when I request the deluge --version
weird because it used to and I do have plugins running and they use python???

Re: Memory usage

Posted: Mon Jun 28, 2021 10:00 am
by mhertz
You can check python version with 'python --version' and also 'deluged --version', maybe need enter python3 for first command when using deluge2, but don't apply to you now atleast. That was indeed a big headache I can imagine getting it working good for you then, damn. The deluge2 packages miss a logging fix from never develop branch, so I also read that for some the log continually grows and can give issues, but don't know if that is related or not here. If ever messing with deluge2 again, then maybe try enabling debug-logging and possibly some clues for the disrepency could be revealed, but don't know honestly. You can install also latest deluge2 dev version by using pip and git, regular install or venv, well don't need pip absolutely as can use setup.py direct, but I just find it easier(if needing help for this later, I can post it) - this will install it outside your regular package managers control however.

Anyway, thanks for posting your instructions and tips, appreciated.

Edit: I just found during searching, that this is probably related to a libtorrent bug, which I've not yet found when started specifically, but should be fixed in libtorrent 1.2.10 or above, though not in the regular repos or PPAs of ubuntu sadly. It could be built manually though, e.g userdocs has script for easy making a static build of the libtorrent python bindings here: https://github.com/userdocs/python-libtorrent-binding. Though still could be a logging issue also, and if having stats plugin enabled then disable it, which further exaggerates the issue I believe. To fix this, then one or two commits from deluge develop either needs backported, or alternatively changing to deluge develop instead, and then also twisted needs be over 19.7 if remember correct.

Re: Memory usage

Posted: Fri Dec 03, 2021 2:14 am
by redeyed
Hi there!

I had the same issue, I use ltConfig (high performance preset) and I had `cache_size` property set to 65536 value
I changed that value to 2048 and memory usage became stable

I'm running deluge on a raspberry pi 4 with 4GB of RAM on Ubuntu 20.04.3

Re: Memory usage

Posted: Sun Sep 03, 2023 2:01 am
by janos66
Is it normal for deluge to use ~1Gb of memory with 1-2 active torrents seeding at ~1Mb/s (but ~100 torrents started for seeding, just mostly being inactive)?
This is not a new thing. I just didn't care because the 8Gb installed memory was always enough for everything (this is a "home server", not a desktop). But as time goes by I started running low on memory in certain situations, so I decided to bring this up.
The cache size and expiration are set to zero (but I also tried setting them to some very small non-zero number in case 0=unlimited).
The current versions are (but as I said, it's been like this for ... may be several years, so versions shouldn't matter that much):
deluge 2.1.1
libtorrent: 2.0.9.0
Python: 3.11.5
OS: Linux Gentoo 2.14