[FIX] Wordpress High PHP-FPM usage


#1

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

Ram: 2GB

CPU: 2 Core

Price: $15

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.


#2

Same issue here what if you want to use Fast cgi cache instead of using wp super cache
?


#3

@vibhi With just FCGI cache it performed well on a 512 MB with 1 CPU Digitalocean server. Load testing report link: http://bit.ly/2HpjXPi

I tested with PHP7 with newspaper theme. Tested page size: 1.8 MB


#4

Hi now digital ocean provide 1gb with 5$ So but php fpm is still high and does i need Memcache although i didn’t install it, It installed by default and noone login other than me so in thinking its kinda useless Also using php7


#5

@vibhi I forget about the DO pricing change. Can you tell me which theme you are using? I will install it on my VPS and let you know about the required VPS configuration.


#6

Colormag and Rowling If you can do it for both that would be cool


#7

Test with Colormag: http://bit.ly/2FdcLQy

There were no massive php-fpm processes except 1-2.

My config: 1GB RAM server Cache: WP super cache PHP: 7


#8

I’m Using fast cgi cache what you think should i use wp super cache


#9

Yes, switch to WP Super Cache. Also, install any remove query string plugin.


#10

These are the results http://bit.do/eeGnu- Easy1easy2


#11

Use the share button in loader.io to share the test results

What values you used in loader and your VPS config is?


#12

I used default config in both In vps simply install Fastcgi Cache and Memcache for object cache via w3t

bit.ly/2JowzCK


#13

In this test, were there several php-fpm processes?


#14

only two process PHP FPM and Most Cpu Consumed by Nginx 13% and High Memory consumption by mysql around 17% In term of Cpu consumption by mysql is almost Very Low and Nginx Memory consumption was very Low but cpu consumption is high


#15

This Plugin Increase The PHP Fpm Usage https://wordpress.org/plugins/clearfy/


#16

To be honest this plugin seems to be useless. All those features are mainly required which this plugin disables and if you really want to disable those features just google it and you can do it via altering WordPress code.

Try to do few more testing with cache (–wpredis cache).

For Publisher wordpress theme. wp super cache performed better than redis cache. What I think is, not all cache methods/plugins work for all the themes.

Also, you can try cloudflare full page cache.


#17

I know i can do it via code but with plugin it was quite simple and Doesn’t take much time and i use almost every single setting in that plugin although it wasn’t something i need my site loading under a second which is Great


#18

Hi I did try Cloudflare caching but it also start caching page for logged in not admin area but front page Cache like toolbar although you can hide but it still cache comment area And I tried a plugin supersonic but which solve the issue by making front end as non logged in user but i dont know how it also cache wp admin area even in page rule i simply set bypass


#19

I’ve figured out some good configurations for nginx fastcgi caching. I will let you know tomorrow. I tested those settings with 10k hits and 100% of them were cache:HIT


#20

Hi doen testing on normal Wp installation Cache enabler With Bypass PhP http://bit.ly/2r7tAYb With out bypass php http://bit.ly/2JChU7o In both cases page is not precached

Simple cache With page pre cached http://bit.ly/2Jy9NZb Without Pre cached page http://bit.ly/2HuXkcn

Wp super cache http://bit.ly/2r8tW0r Well do more with Super with better setting

W3tc With out pre cache op cache , memcache not active http://bit.ly/2Kge9W1 W3tc Pre cached http://bit.ly/2HwShbm

Nginx Fast Cgi

With out memcache pre cache page http://bit.ly/2Kmm9Fl

With out Page cache

http://bit.ly/2Hygo9I Fast Cgi show great Response time But crash mysql if page is not cache and Alot of user hit the page