Page 1 of 1

Memory Usage Spike - Newbie

Posted: Wed Jun 13, 2018 11:20 pm
by Dcduo
Hello everyone,

I'm currently running Vesta on CentOS on a cloud server I got through lcn.com. I'm really new to this field but I've been enjoying tinkering around with it. My friend, who runs a woodworking machinery business, also had the same setup through LCN, only a tier up and a big overkill, I think, for his single ecommerce site.

To help pay for my own server, I recently offered to host his site on mine. It happened that his own site occasionally went down with "Error Establishing A Database Connection" from time to time, that could only be remedied by restarting the server, and I hoped that having it on mine might also somehow solve that problem for him.

Unfortunately, it didn't. Every so often the site goes down in what seems like an irregular pattern. Checking the graph, I noticed a big memory spike before it goes kaput. Adding a swap file seems to make them a bit less frequent, but they still come.

I'm not sure what to do, what logs to check or how, and my Googling has only got me so far! I would really appreciate any advice anyone could give.


Many thanks in advance,

Darran


Image
(9:30pm the memory spiked and all sites on server went down. 9:45am I restarted and all back up)

Re: Memory Usage Spike - Newbie

Posted: Tue Jul 03, 2018 5:44 am
by pipoy
Happens to me all the time. if you see "Error Establishing A Database Connection", just start the database server. No need to restart the OS

Next, I assume he is using wordpress? I think "Error Establishing A Database Connection" is a wordpress error?

2gb of ram may not be enough. I tried optimizing for wordpress but I still cannot avoid this issue.

What you can do:

Disable your anti virus to get more RAM - Not recommended
Upgrade your server

or

Stop using wordpress. No really. Wordpress is a blogging platform. Installing a bunch of plugins to make it a whole new platform is not really a good idea. But still, a lot of people use it.

On a different server of mine, I also run an e-commerce site on a 2gb ram and I dont get this problem. I think because my e-commerce is not based on wordpress.

Try using opencart instead.

Re: Memory Usage Spike - Newbie

Posted: Tue Jul 03, 2018 5:32 pm
by Felix
I can tell from the graph that some process eats a lot of RAM and that causes MySQL to run out of memory and thus fail/stop.

It could be Apache, which can eat large amounts of RAM if not configured correctly. To fine-tune apache, I use apache2buddy. A perl script that checks your apache configuration and suggests correction(s).

An easy way to use the script would be to run:

Code: Select all

curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/master/apache2buddy.pl | perl
Make sure that your MaxRequestWorkers setting is within acceptable range and don't forget to re-run the script from time to time.