I was trying to setup 4 wordpress sites with 1M monthly users but each time I do load testing several php-fpm processes spawns and takes up all the CPU and even sometimes Mysql server goes down by this. After figuring out the issue I got to know that it was cache that wasn’t working properly. So, I deactivated all the plugins and activated on cache plugin. Now I did load testing with 10k clients and got just 1 php-fpm process with 20% CPU usage and 15% memory usage. Now I sent 3000 popup visitors(best way to do real testing) which cost me just $0.3 and all of them were accounted in google analytics. Now I activated theme required plugins one by one and do that testing process each time and in the end by activating all required plugins I was able to setup my website completely and was no php hit instead of cache hit.
For those who are facing several php process and high CPU usage, I would suggest you to do follwing setups to check for plugin or theme related problems:
Activate Wordpress default theme Deactivate all plugins and activate WP Super cache/W3/Redis+Nginx helper Use each cache plugins one by one Now do load testing(Link given at the end) Use top command in SSH window to check if there’s any php process or not Activate your desired theme and theme page builder Don’t activate any plugin other than page builder you are using Now again do load testing Now activate each plugin one by one to check for a plugin that doesn’t work with cache. Follow the above steps carefully and let me know what are your results.
I did it with 2 themes which I want to use and were causing the cache issue. Hope this will solve your CPU usage issue.
Free Load testing: https://loader.io/
Server used in testing: Digital Ocean
CPU: 2 Core
1st Test: WP super cache
2nd Test: Redis + Nginx Helper
Reply to this thread and if you face any issues.
NOTE: This fix might not be applicable for everyone.