Memory usage / leak
-
I've got a problem with memory consumption of NodeBB. In peace times it uses around 110 MB memory. But from time to time memory consumption increases very fast and NodeBB gets killed (by a bot run by my hosting provider) when it reaches ~620 MB memory usage.
I already have a cronjob in place to restart NodeBB when this happens, but I'd like to know if and how this could be troubleshooted? The logs don't tell anything abnormal, it just ends with
Shutdown complete
. There are no errors, no warnings, nothing. However, it only happens during the day when multiple users are using the forum. But I can't believe that user load is the cause of the memory consumption, since I only have 5 users total registered.Also, is there a way to force nodejs' garbage collection to run regularly?
thanks,
Tom -
I'm now at 487 MB, this is what is shown in that info page (redacted):
[ { "process": { "port": "60606", "pid": 31056, "title": "/package/host/777/nodejs-6.13.1/bin/node", "memoryUsage": { "rss": 511139840, "heapTotal": 111964160, "heapUsed": 98784216, "external": 20004693, "humanReadable": "487.46" }, "uptime": 88068.913 }, "os": { "hostname": "localhost", "type": "Linux", "platform": "linux", "arch": "x64", "release": "2.6.32-696.18.7.el6.x86_64", "load": "0.62, 0.87, 1.01" }, "git": { "branch": "v1.8.x", "hash": "2b27f1f398f73ec215a584b27f72dd588f8f0b85" }, "stats": { "onlineGuestCount": 0, "onlineRegisteredCount": 3, "socketCount": 4, "users": { "categories": 0, "recent": 0, "unread": 1, "topics": 2, "category": 0 }, "topics": [ { "tid": "344", "count": 1 }, { "tid": "372", "count": 1 } ] }, "id": "localhost60606" } ]
-
Update:
here's how it looks if you monitor memory usage. Within a couple of seconds usage goes up to 800+ MB, falls down a little, then the process gets killed:
(One column is 5 minutes)
Oh, and we had no active users online during that time.
And here's another such event, one hour ago, with 1 active user:
-
Do you have any custom plugins?
Nope, default install.
Are the spikes happening on regular intervals?
It seems, at 12 p.m. every day an event happens, but others are happening at random times, mostly in the evening, sometimes at night.
Maybe something is running that requires a lot of memory.
What would that be? What should I look for?
I suggest adding swap so the process doesn't get killed and monitor the spikes to find a pattern.
Can't do that, it's a shared platform, I'm not even root.
- Tom
-
Honestly I can't imagine why this would be the case. In our experience NodeBB has been fairly stable in terms of memory usage (it will creep up over time, although this is mainly due to post cache and such)...
What does your ACP dashboard show, are you seeing many visits from spiders? Do you have lots of topics but low user counts?