How to troubleshoot overloading server?

I use EasyEngine to setup Nginx with fast_cgi. I have a couple wordpress sites hosted.
Since the addition of my last Wordpress site, I am having issues with CPU usage overloading. Everything seems to be running just fine for a day or more at a time until suddenly my entire server shuts down due to being overloaded. It happens so fast I can’t even log in via SSH to see what exactly is running. Rebooting the server allows me to reconnect again and the problem goes away for some period of time.

Where is a good place to start looking for possible causes of the immediate overload of my server? Thank you

You could try and install New Relic with NGINX, PHP, MySQL exstentions to find out where there might be issues.

Potentially AWStats could help with this, but there may be a good reason for why it’s not already part of the Easy Engine Admin Tools.

Also, collectd with the nginx plugin could help. Again, there may be a good reason collectd is not already part of the Easy Engine Admin Tools.

If these two utilities haven’t been considered to be a part of the Easy Engine Admin Tools in the past, they should be considered for near future additions.

Thanks for the replies so far, I disabled WP super cache and have not had the cpu overload issue since. However, now I get 502 bad gateway errors maybe once a day, so I’m having to tweak fastcgi buffers and timeout settings. Any recommendations?

Oh yuck!

Any 502 error can be troubling, because it is an HTTP Status Code, whose text is displayed differently based on the server hosting the page you are trying to access and the web browser you are accessing it from (probably a couple other factors as well).

Most often this is some type of server error, but it can also be a localized issue, in how the web browser you are using, manages its browser cache.

The best way to start troubleshooting this issue further, is to look through your server logs. If the error is occurring at a specific time of day, it may be due to some script (or API) that runs on your website or on the server itself. If the error occurs when accessing a specific page, you can drill down into that page.

One thing is for sure, there is always a reason, it just isn’t always easy to find. If it seems like the error is occurring randomly, try researching things like the MySQL Server logs, server disk space/usage and your own personal computer (web browser cache management).

Specifically, I’d be interested in the output of the:

SHOW BINARY LOGS

…MySQL/MariaDB command, and the:

df -h

…linux command.

These may have absolutely nothing to do with the situation and there may be loads of people who don’t think the information would be relevant. However, I suspect MySQL issues could cause 502 errors just as easily as other sources, especially if database binlog files are eating up your disk space, leaving little/no room for things like caching.

Had a 502 Bad Gateway error myself today. Turns out my issue was an issue with php5-fpm

sudo service php5-fpm start

…fixed my issue. This link (http://stackoverflow.com/questions/29442584/502-bad-gateway-nginx-fastcgi-cache) suggests the “Bad Gateway” error usually occurs when nginx cannot proxy to your backend.

Unfortunately, for me, this brings up more questions, like: Why did this happen to begin with, especially since this was a brand new install, on a newly provisioned server?

Had a 502 Bad Gateway error again today, on another newly provisioned server. Confirmed again the issue was with php5-fpm as:

sudo service php5-fpm start

…fixed the issue, immediately.

In the last 7 days, I’ve done 3 new installs of Easy Engine, with 3 newly provisioned servers and all 3 turned up with “502 Bad Gateway” errors, as seen in the following attached screenshot:

…all resolved with:

sudo service php5-fpm start

All 3 installs also had issues with:

nginx: [emerg] "worker_rlimit_nofile" directive is duplicate in /etc/nginx/nginx.conf:4
nginx: configuration file /etc/nginx/nginx.conf test failed

…as seen in the following attached screenshot:

…which is easily resolved by deleting the duplicate line, but still, a built-in problem with the Easy Engine installer.

Hi,

sometimes a bad plugin/theme code also causes high CPU utilization.

You can do following things:

Visit: https://example.com:22222/fpm/status/php?full&html

Here you can see which pages are currently used in process by FPM.

Also you need to debug your site to point slow queries which are causing high CPU loads. You can use ee debug --php

Which version of EasyEngine are using? I hope this bug was fixed with latest EE.

@gau1991

sometimes a bad plugin/theme code also causes high CPU utilization.

Is both true and a pretty strong assumption.

This “502 Bad Gateway” error is occurring on new installations, with no plugins or themes yet installed (except of course, the nginx helper plugin, and the caching plugin, which are both installed by the ee installer). So, I haven’t even gotten to the point of being able to install plugins/themes or even configure WordPress for that matter, when the “502 Bad Gateway” error presents itself.

Which version of EasyEngine are using? I hope this bug was fixed with latest EE.

I’m pretty sure I’m using the most current version, which I thought would be easily understood when I said: “In the last 7 days, I’ve done 3 new installs of Easy Engine, with 3 newly provisioned servers and all 3 turned up with “502 Bad Gateway” errors” in my last post.

If I run the following command, what version of EasyEngine gets installed?

wget -qO ee rt.cx/ee && sudo bash ee

Which version is the most current version?

When I run:

ee --version

…I get the following info:

Is EasyEngine v3.1.2 the most recent version?

Hi @hpidriver

Please try the latest EasyEngine. Use ee update to upgrade your current EasyEngine version to the latest.

It’s been a long time, and we haven’t heard from you. It looks like your issue is resolved.

I am closing this support topic for now. Feel free to create a new support topic if you have any queries further. :slight_smile: