High CPU usage PHP-FPM

Hi all,

Perhaps this is a silly question but I’ve recently migrated a Wordpress website ( from another hosting provider to Digital Ocean. I used ServerPilot to config the LEMP/LAMP stack and successfully migrated my website.

I’m really new to all this but I see a strange trend: while mi CPU load goes to the roof when getting close to 1000 active concurrent visitors, my RAM stays flat (around 10% usage). CPU top process graph says that all the load comes from php-fpm and mysql

Do you think this is expected behavior? Do you have any recommendations for this?

Thanks in advance, Carlos

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi, @carlosv, did you get your CPU load fixed? My problem is very similar: I am using WP Rocket, ServerPilot and 32 gb RAM, 8core CPU. When I get more than 1000 active concurrent visitors my php-fmp goes to the roof and my TTFB gets very high. Cheers.


As traffic grows, so will resource usage.

One way to reduce usage is to implement caching so that each page load doesn’t hit the database. There are a number of caching plugins available, though WP Super Cache and W3 Total Cache are probably the most popular.

WP Super Cache is a bit easier to setup and works with very little configuration. On the other hand, if you need something more advanced and you plan on using Redis or Memcached to cache (instead of using the disk), W3 Total Cache would be a better, but more complex option.

Personally, I much prefer simple caching using Redis, though it’s a bit more of a manual setup than it would be with the two plugins above. This is a rather simple plugin, but you’ll need to install Redis, and then do some configuration in wp-config.php to get it working as expected.

Caching alone, however, isn’t a magic fix-all. Last I recall, the configuration for MySQL and PHP that ServerPilot uses is either the defaults or pretty close to it, so it’s most likely not tuned for higher than average traffic (and by average, I mean very low to low).

Caching works as another layer to improve performance, but you also need to work on tweaking and tuning the stack itself (NGINX/Apache, MySQL, PHP-FPM, etc) to get the most out of what you’ve got.

Upgrading to a higher plan with more CPU might help, though ultimately, with the same configuration and no caching, you’d likely end up as you are now with higher CPU usage due to so much needing to be processed.

I have a very similar problem. And oddly enough, it used to be the other way around. My server would max out of RAM while the CPU was low. It seems this could have to do with PHP-FPM settings such as pm.max_children, pm.max_requests and the mode whether it be dynamic, on demand or static. At the moment I’m using on demand, max children set to 400 and max request left blank. I got about 900 simultaneous visitors each trying to add a product to the cart and checkout. At this point the server slows down as the CPU starts to approach 90% and ram about 14%.

Wordpress Version 5.7.2 WooCommerce Version 5.3.0

Server architecture Linux 4.18.0-240.10.1.el8_3.x86_64 x86_64 Dedicated Server with only one primary website on it. CPU: 8 Core x 3.0 GHz (Intel Xeon Silver 4123) RAM: 96 GB NVMe2 x 1000 GB Hardware RAID 1 Data transfer rate up to:1 Gbps

Web server nginx/1.18.0 PHP version 7.4.18 (Supports 64bit values) PHP SAPI fpm-fcgi PHP max input variables 1000 PHP time limit 240 PHP memory limit 1024M PHP memory limit (only for admin screens) 72000M

PHP-FPM settings in Plesk pm.max_children = 400 pm.max_requests = blank pm = On Demand

Database: Extension mysqli Server version 10.3.27-MariaDB-log Client version mysqlnd 7.4.18