Thrashing with 1.8GB plus 3GB swap

I have discovered a problem.

I have a bunch of forums all running absolutely fine on 1vCPU 3.5GB RAM VMs.

Based on previous discussions, it seems that 1GB plus swap is adequate to run a low volume forum.

So I experimented by moving a number of forums to 1.8GB RAM plus 3GB SSD swap VMs.

They ran fine for a while with basically zero swap usage. Then suddenly out of the blue they started thrashing. Swap usage shot up to 60% with low CPU % and the web server because non responsive.

Rebooting doesn’t help. It immediately started thrashing again.

So I ended up moving them back to the high RAM sizes.

Since the situation persists thru reboots, I suspect it has something to do with sidekiq or redis…

Probably something to do with the fact that 3.5GB RAM + 1GB swap is not the same as 1.8GB RAM + 3GB swap.

To find the memory usage culprit, you’ll want to look at process sizes. Chances are you’re running too many unicorns.

Only two unicorns. The 3GB size does not use swap.

That’s why it stumps me…


Green line is swap. Magenta line is RAM.

One thing that may help pin point the issue: Previously I’d get a sidekiq restart error occasionally claiming it is using too much memory, 500MB or something.

So I can understand that if sidekiq can use up to 500MB or more, the system really wont fit on 2GB of RAM.

Thing is, no idea why because my forum is low volume. I can’t understand how people can run Discourse in 1GB droplets…

OS is Ubuntu 17.10. They are all 64bit so perhaps that’s one reason?

Depends heavily on usage, what are the /about page stats? How many simultaneous active logged in users? Any weird third party plugins?

Never more than 10 logged in users and emails and spaced quite long time.

Resources on the net all recommend against using 64bit Linux as they occupy 1.7x the RAM of 32bit. Up to double some says.

Can this be the problem I am seeing? Anybody running Discourse on a 64bit VM with 1GB RAM?

Instead of leaping around grasping at any theory that comes along, how about you gather some data – like look at the memory usage of the processes on your system – and make a deduction from there? Without knowing which process is hogging all the RAM, you’re throwing darts whilst blindfolded.


OK I’ll do that. Just don’t want to muck with t production forums and those are the ones with traffic…

Did you run disourse-setup or otherwise adjust the memory settings?

Well you may be right. The discourse is setup when the VM was 3.5GB. Then I down sized it to 1.8GB as an experiment.

Perhaps some settings need to be treated?

1 Like

Either read the comments in the file or just run disourse-setup and it will adjust them.