Memory (MongoDB)
-
I know this issue has been raised before, but how is the mem-usage supposed to be for NodeBB?
I have a 500MB Digital Ocean droplet, only NodeBB and MongoDB running, and I got 61MB free with no-one but me and my 59 posts in the forum atm, and the MongoD has been running for about three weeks.
Initially I thought MongoDB was the hog, but I am now bit amazed that it's NodeBB. Not sure what I was expecting, but still a but puzzled about that...
$> free -m total used free shared buff/cache available Mem: 488 302 59 0 127 154 Swap: 0 0 0 $> top PID USER PR NI VIRT RES SHR S %MEM %CPU TIME+ COMMAND 2282 gnimmelf 20 0 1350308 180760 16624 S 36.1 0.0 0:16.46 nodejs 2024 gnimmelf 20 0 955644 40172 10268 S 8.0 0.0 0:01.00 nodejs 1269 mongodb 20 0 268956 34404 364 S 6.9 1.3 0:17.84 mongod
-Both
nodejs
's are NodeBB...If I start with
./nodebb dev
, I'm left with 9MB free, which kills it when I install plugins in dev mode...Maybe we could spec out some aprox. minimum requirements for NodeBB, pref in conjunction with DB setups (MongoDB, I hate reading your documentation!)?
If I open up this forum for the intended people, around 200, it will probably die quite often, I can assume, even though I doubt there will bee too much traffic.
Per now my only option is to resize the droplet to $10 or $20, which is doable, but not preferable to technical trimming of any kind
Please advice, and I'll be happy to help.
/Cheers
-
@Flemming-Hansen you should setup swap space. I have 3 nodebb instances running on a $5 droplet without problems although they are demo instances with very low traffic.
-
As @pichalite says, you must set up swap, or else your OS might OOM and terminate Mongo
A 512mb server will support a NodeBB forum just fine, and the OS won't 'free up' memory unless it's actually needed, so
free -m
will show higher memory utilisation even though not that much memory is actually being used. -
Agree, but D.O. does not reccomend swap on their SSDs, due to to hardware degradation...
Maybe not such an issue with my low usage?Just discovered
#define ENOMEM 12 /* Out of memory */
-
@Flemming-Hansen said in Memory (MongoDB):
Agree, but D.O. does not reccomend swap on their SSDs, due to to hardware degradation...
Maybe not such an issue with my low usage?Just discovered
#define ENOMEM 12 /* Out of memory */
If you're concerned about hardware degradation, set up swap and set the swapiness value to 1! Then no process will get out of memory while no swap will be used if it is not needed.
-
I also use DO 512 droplet, my stats:
>$ free -m total used free shared buff/cache available Mem: 488 309 9 0 169 150 Swap: 2047 349 1698 >$ top Tasks: 125 total, 1 running, 124 sleeping, 0 stopped, 0 zombie %Cpu(s): 29,5 us, 3,5 sy, 0,0 ni, 65,1 id, 1,3 wa, 0,0 hi, 0,3 si, 0,2 st KiB Mem : 500240 total, 10380 free, 326400 used, 163460 buff/cache KiB Swap: 2097148 total, 1658900 free, 438248 used. 144060 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 26782 user 20 0 1742332 242332 6188 S 6,7 48,4 291:51.62 nodejs 31669 user 20 0 43612 3800 3204 R 6,7 0,8 0:00.01 top 1 root 20 0 37888 3316 2192 S 0,0 0,7 0:15.36 systemd
Nodebb:
Page views in last 24 hours --- 195,441
Users 2,842
posts 116,070 -
@Flemming-Hansen said in Memory (MongoDB):
Agree, but D.O. does not reccomend swap on their SSDs, due to to hardware degradation...
Maybe not such an issue with my low usage?Yes, that is true... setting swap up on an SSD is potentially "not as good", only because you're shuttling data back and forth from SSD and RAM, increasing the writes to the SSD... but that said, they still do have an article about configuring it...