Memory Usage, Threshold Understanding, Upgradability Questions


(Travis) #1

My Discourse is hosted on Digital Ocean (2GB). According to Real-Time Google Analytics, there are about ~10 concurrent users at any given time. At peak times it can rise to as many as 20.

New Relic is listing the Apdex score at .99 (the best being 1.0, so that’s good). However, the memory usage on the server is generally at 75%. I’m running 3 unicorn workers.

Memory usage as follows:

I guess I’m just wondering if that’s normal and what my upgrade strategy should be in terms of growing concurrent users.


(Kane York) #2

I would say that if you’re about to start swapping, then you should increase your RAM. To do this, power off the server shutdown -P now, go to the Digital Ocean site and use the Resize thingy to increase the RAM, then click Power On,

So, not yet.


(Jeff Atwood) #3

Any comment on postmaster / messagebus memory usage @sam?


(Sam Saffron) #4

Postmaster is postgres. Seems like its consuming a bit of memory, but not an totally unreasonable amount.


(Travis) #5

Could it be related to this python script I’m using for Mumble? It’s running on a completely different server but it is connected to postgres.


(Sam Saffron) #6

no idea, it is possible, try stopping the script and rebooting.

monitor memory.


(Jens Maier) #7

That memory measurement is probably wrong. Postgres consists of several forked processes. A large chunk of the displayed memory usage will be in copy-on-write pages.

vmstat -a gives an accurate measurement of all memory that is allocated to processes (active).


(Sam Saffron) #8

My favorite tool for correct memory analysis is smem


(Travis) #9

Even with no load and no one on the forum right now (6AM here) it’s at 77%.

procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free  inact active   si   so    bi    bo   in   cs us sy id wa st
 1  1  24680 120404 502312 1023828    0    0     3    31    2    5  2  0 98  0  0

(Jeff Atwood) #10

Any updates on this? Is memory a problem for your instance? What does free -m say?


(Jeff Atwood) #11

Be sure to update to latest, @sam did a ton of work to reduce memory footprint.


(Bruno) #12

What is the “normal” memory usage?

Mine seems pretty high:


(Rafael dos Santos Silva) #13

You don’t seem to be swaping, so it’s probably fine.


(Jeff Atwood) #14

This depends heavily on how many daily active users you have, logged in and anon.


(Bruno) #15

These are my stats:

So about 2.000 members. No idea if the activity is considered high or not.

What do you think? Should I worry about memory usage?

I was talking with my server guys about this. And it seems they get an alert pretty much every day that the site is inaccessible. Not sure which tracking app they use, but that’s what they sent me. So that’s why I’m trying to figure out if there’s something wrong.

They sent me this and this image showing that, if it helps.

That’s probably not normal right?

Current memory usage:

Let me know if you need more stats like top or something. Disk usage is 29% out of 39.25Gb, so that looks fine.

Thanks again!

PS: I’m on latest Docker and Discourse version, 1.6.0.beta12


(Jeff Atwood) #16

Well, if you have doubts, it never hurts to bump memory (and/or CPU), if you have the budget. Memory is generally more critical.

Be sure to adjust up the number of unicorns (2 per CPU) and the postgres memory allocation (25% of memory) in app.yml when you do that.


(Bruno) #17

Yeah sure, I really won’t mind upgrading the server if it’s needed.

I just want to confirm that is indeed needed. That there isn’t something wrong with my install which will build up and consume memory for no reason.

For that kind of activity and members, do you think my memory usage is ok? Or higher than what it should be?

Thanks again!


(Mitchell Krog) #18

Hi all, I did search for an answer to this specific question but cannot seem to find it or I am blind.

I have box with 24 Gb memory, I changed the db_shared_buffers: "4GB" and UNICORN_WORKERS: 6
I then did a ./launcher rebuild app

But for the life of me I cannot find out if the memory is now allocated or not, can’t find anything in the admin settings screen to show me this info. Is there a command line to query the app and it’s settings? or am I missing something in the admin side which shows me all this info?


(Jeff Atwood) #19

top or htop will show the correct number of unicorn workers. As for db buffers, you’d need to query postgres for that.


(Mitchell Krog) #20

Thanks @codinghorror I think I got the settings all correct. Running like a beast and super fast, will see once it goes live and people start using it to see what strain it experiences if any.