1

So i got a Google Cloud VM which is running a woocommerce store. It works fine but now i got this problem for the second time. The VM's CPU Usage suddenly goes over 99% for a long period of time. During that time the site is basically offline.

When i stop the VM and then restart it it goes back to normal CPU usage which is <1% most of time and 1 - 10% some periods of time.

Also when i use sudo kill with the process id's of the .php-fpm.bin it solves the problem for a few hours but then it starts running the .php-fpm.bin again under a different PID.

Also when i use killall on .php-fpm.bin the website goes down altogether.

This is a big issue which can turn very bad very soon and i'm a beginner with servers.

Any help with the root cause of this will be very very much appreciated!

--EDIT--

Here is my CPU usage shown using 'top' on SSH:

result top on ssh

Something unusual is going on with .php-fpm.bin, anybody got an idea of what i might be?

This is visible when i type ps auxin SSH:

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
daemon   10048 99.9  0.9 286860 71564 ?        R    13:13  83:15 php-fpm: pool wordpress 

If you need any other monitoring stats please do tell me what you need to know and i will look it up for you.

  • These PHP processes are using up all the CPU resources indeed. Did you look at your web server access and error logs? Also your php-fpm logs? – David B. Dec 2 '16 at 8:21
  • 1
    Did you check your programming? Some pages may run processor bound loops that never end due to programming errors. – TomTom Dec 2 '16 at 8:56
  • 1
    You might want to have a look at these two posts 1,2 – Carlos Dec 2 '16 at 18:30
  • I saw those posts already, they didn't solve my problem. – luissimo Jan 7 '17 at 14:27
  • Have you looked at your access logs (try filtering by wp-login.php) and error logs to see if there is a correlation between a spike in access (likely login bruteforce attempts into WP) and php-fpm using a lot of CPU? Do you see any sigkills during these periods of high CPU usage? – Gaia Jan 8 '17 at 20:16
1

Caveat: I'm also not a server / sysadmin person but had to dive in earlier this year.

I've encountered performance issues like this when running node.js processes. It's possible there are parallels to what you're seeing. In my case, based on changes I experimented with it looks to have been related to hitting max pages limits.

These are configuration changes I performed that helped resolve issues:

In /etc/security/limits.d/custom.conf

root soft nofile 1000000
root hard nofile 1000000
* soft nofile 1000000
* hard nofile 1000000

In /etc/sysctl.d/99-sysctl.conf

fs.file-max = 1000000
fs.nr_open = 1000000
net.nf_conntrack_max = 1048576

To update running processes:

sudo sysctl -w fs.file-max=1000000
sudo sysctl -w fs.nr_open=1000000
sudo sysctl -w net.nf_conntrack_max=1048576

As root:

ulimit -n 1000000

You're milage may vary based on what's managing your processes.

Here's some documentation with further sysctl tweaks, some of which I plan to research and implement: https://easyengine.io/tutorials/linux/sysctl-conf/

  • Didn't work for me, unfortunately :( – luissimo Jan 7 '17 at 14:27
0

@luissimo This server has no swap space (see top headings), so it can't swap processes out. Allocate a disk (probably minimum 200Gb).You have 8Gb memory. So use fdisk to partition the disk in two, say 1st partition of 16Gb as swap area, 2nd partition the rest. See if that helps.

  • 1
    How would that possibly help? Without swap space the server runs into memory problems if it is out of memory. That would result in processes terminating - but not high CPU usage, or? This looks a lot more like soemthinc causing high CPU usage, for example google coming around and crawling. – TomTom Dec 2 '16 at 8:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.