Solutions for High CPU Usage by php-fpm Processes (php Consuming Excessive Server CPU) and WordPress Opening Speed Optimization Guide
Starting last night, this site suddenly hit 100% load and 100% CPU usage, making it inaccessible for nearly a full day. I couldn't even log into the admin dashboard, and I initially suspected a cryptominer infection. After contacting the server support team and troubleshooting, we found that PHP was consuming excessive resources. It was a struggle to get into the backend and adjust the PHP configuration. (This also serves as a WordPress performance optimization guide, by the way.)
I didn't fully understand the underlying principles, so I searched through many articles on Baidu and eventually summarized the solution into one core point: tweaking a few PHP configuration values was all it took.
Set max_execution_time to 30 (The default value is quite high. I'm guessing this controls the maximum runtime for scripts—reducing this value should lower concurrency and queued processes, meaning fewer applications run simultaneously, which reduces resource usage.)
Adjusted max_spare_servers to 10 (This likely controls the number of idle queued processes. A safe rule of thumb is to set this to about 70% of the max value.)
Set pm.max_children to 25 (This is the maximum number of child processes running simultaneously.)
Each process consumes about 30MB of memory. Depending on your server's RAM, keep this value well below 85% of your total memory usage, and you'll rarely encounter those "site won't load" issues (unless you have a huge spike in concurrent visitors, but generally, you shouldn't hit 100% load again.)
For WordPress, try to avoid installing the official Jetpack plugin if possible. Over time, it can cause PHP process usage to skyrocket. My site was running normally—only updating posts, no other major changes—and then suddenly, after a couple of months of having Jetpack installed, PHP usage spiked and the server went into overload.
> How to Create a WordPress Website and Earn Revenue from Google Ads | Solution Guide