Closed ElDifinitivo closed 2 years ago
Old versions of golang have a "feature" of not freeing memory until there's memory pressure (bad perf). You could set this env var as a temporary workaround (as per docs/systemd/monolith-example.service (comment add by me) )
# Use less memory; this became redundant in golang 1.16
Environment=GODEBUG=madvdontneed=1
But I would recommend upgrading to a newer golang, because 1.16 will be the minimum for future versions of dendrite.
So with go version go1.17.6 linux/amd64
from bullseye-backports
and was still getting the issues but after 15+ minutes. Messages like monolith_1 | [1] [WRN] pipe - cid:49 - "v1.13.0:go" - Readloop processing time: 5.674480815s
began to pop up when left running and I wondered why v1.13.0 was being used in some way.
I restarted the VPS and it seemed to have cleared any issues (potentially cache? idk). Mem usage for dendrite rises and peaks around 300/400MB again.
I ensure everything is built fresh (with debian's 1.17.6) by git clean -fdx
and deleting ~/go and ~/.cache in dendrite's system account. I don't use any container stuff, just a system account with all dendrite-related files in its $HOME and my /etc/systemd/system/dendrite.service
Background information
docker --version
:Docker version 20.10.5+dfsg1, build 55c4c88
uname -a
:Linux <HOSTNAME> 5.10.0-11-amd64 #1 SMP Debian 5.10.92-1 (2022-01-18) x86_64 GNU/Linux
docker-compose --version
:docker-compose version 1.25.0, build unknown
go version
: 1.15.15Description
Recently updated to 0.6 from 0.5.1 and noticed slow increases of memory usage until it overloads the server dendrite is running on, causing
kswapd0
to spike CPU usage rendering the VPS entirely unusable.There are only 2 users on this homeserver, and I never saw memory usage on 0.5.1 going past 400MB. The VPS running dendrite has 2GB, and dendrite will slowly rise from 200MB to over 1GB (without any activity on the homeserver, both users using Element).
All users on the homeserver. The VPS will overload, causing constant connection issues for any client.
Immediately upon starting the homeserver (
docker-compose -f docker.compose.monolith.yml up
). It usually takes just around 10 minutes before memory usage is maxed, swap attempts to mitigate to no avail, and CPU usage spikes to 100%.Upon updating to 0.6, everything ran smoothly, nothing manifests on the client end of potential issues. After a short time of ever-increasing memory usage, dendrite maxes out the system resources.
Steps to reproduce
docker-compose -f docker-compose.monolith.yml up
)The output of starting the homeserver. It took just under 11 minutes to max the system resources before
Ctrl+C
. No clients were being actively used at the time.