Php-fpm7.0 Chewing up over 50% of my CPU resources


#1

I’ve been monitoring my stats with nixstats over the last few weeks and overall CPU usage has been around 25% with server loads hanging out around 0.2 to 0.6.

Nothing too special with 3 WordPress websites running on a 2-core 4GB RAM VPS.

However, this weekend I noticed CPU usage hitting up to 70% and server loading going as high as 4.3. Looking at my nixstats service, the only thing out of the ordinary seemed to be php-fpm7.0

As of right now, 9AM (not a busy part of the day), php-fpm7.0 is eating up 50% of my allotted CPU resoureces, whjlie other services like nginx, redis server, mysqld are between 1 and 3% total.

I’ve tried reboots, restarts, shut downts, and have upgraded server components

Although in this last part, I am being told that Redis has changed that I have kept it the same due to paranoia that it will impact my current setup.

I’m using Redis for cache with the Simple Cache plugin to handle things. This has been fine for weeks but I may need to experiment and try a different cache plugin.

I thought that maybe it was because wp-cron was being hit too much so last night I put

  • define(‘WP_CRON_LOCK_TIMEOUT’, 900);

in each of the wp-config.php files for those three servers. But it doesn’t seem to help. I mean, CPU usage isn’t at 70% right now, but again, it’s just 9AM so I expect this to go up as more people wake up.

Does anyone have a clue as to what is going on. I don’t recall making any additional changes to the server other than getting rid of AMP for WP due to its security issue and swithcing to the official AMP plugin from Google in the WP respository.


#2

Hello,

if you are using --wpredis, you should not need an additional cache plugin (especially cache plugins not supported by EasyEngine --> all requests are passed to WordPress with a plugin like Simple Cache, when requests are directly served by Nginx when possible with other EE setup --wpfc --wpsc).

But redis cache resources usage is often higher than fastcgi_cache. That’s why, on all single server setup I prefer to use nginx fastcgi_cache rather than redis-cache.


#3

But redis cache resources usage is often higher than fastcgi_cache.

But do you have any idea why this happened all of a sudden? It makes sense that it would be that RAM resources are higher when using Redis (since it is an “in-memory data structure project”). . .but what would that have to do with CPU usage, and in particular, the CPU usage of Php-fpm7.0?

I will go in and uninstall the Simple Cache plugins (it was some other user that recommended me to use it) as I was having cache issues with --wpfc and Woocommerce


#4

Have you disable wp-cron on page loading or have you just increase wp-cron timeout ? Because with Woocommerce, cronjob use a lot of resources.


#5

So, I went in and removed the Simple Cache applications from those websites and then added

  • define(‘WP_CRON_LOCK_TIMEOUT’, 900);

to wp-config.php.

After about 3-4 hours everything seems to be back to normal on that server. Overall CPU usage averages between 25-35% again and php-fpm7.0 is only using 14.5% of my current CPU usage like it used to

I figured it the cron lock timeout option didn’t work then I would disable it via the file and then create my own cronjobs in a terminal. But so far it seems to have settled back to how it used to be/how I have come to expect. (this is still with Redis as the cache method)