Host to host networking speed will vary. We have tested and using these PHP5-FPM www.conf tweaks for WordPress HP Cloud to load within a decent time. If you are following our guides then definitely you are using Nginx Microcache for factcgi. Tweaking only the www.conf
‘s spare_server
can load WordPress from 4.2 seconds to 3.0 seconds! For the tweak, the is why file is present!
First work for the webmaster to block these data in this PRISM mass surveillance era. Easy to say, think, wish; very difficult to do. Different topic, but think about it. If you allow too much bad traffic, bot to crawl, they will eat your bandwidth and make the webpage loading slower. Loading a page sucks some computing power.
Before Doing PHP5-FPM www.conf Tweaks on HP Cloud
We really have been used we OpenStack floating IP and Snapshot for effective backups for years. May be you can use file level backup on other hosts. Most good web hosts are running OpenStack. Rackspace users will not have much difference in this part.
---
We are talking about a normal PHP5-FPM installation from Debian or Ubuntu source to their mirror by the hosts. We have a PHP5-FPM restart issue fix thing on Github, you can search on Github for it. We already configured ping and status. If you do not know much about ping, do not enable it. For these tutorial, nothing among the above is needed as mandatory option.
PHP5-FPM www.conf Tweaks For WordPress (HP Cloud)
Normally on deb GNU/Linux, the www.conf
file should be here :
1 | /etc/php5/fpm/pool.d/www.conf |
When you change the configuration of PHP5-FPM, you should run a config test like Nginx :
1 | php5-fpm -t |
Thereafter restart :
1 | service php5-fpm restart |
We are using UNIX socket to listen. This is an example tweaked sample for a 4 GB dual core instance :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | [www] group = www-data listen = /var/run/php5-fpm.sock listen.owner = www-data listen.group = www-data listen.mode = 0660 pm = ondemand pm.max_children = 15 pm.start_servers = 8 pm.min_spare_servers = 8 pm.max_spare_servers = 12 pm.process_idle_timeout = 10s; pm.max_requests = 0 pm.status_path = /status ping.path = /ping ping.response = pong chdir = / security.limit_extensions = .php .php3 .php4 .php5 php_flag[display_errors] = off php_admin_value[error_log] = /var/log/fpm-php.www.log php_admin_flag[log_errors] = on php_admin_value[memory_limit] = 128M |
As you can see for the part we love to talk about :
1 2 3 4 5 6 7 8 | pm = ondemand pm.max_children = 15 pm.start_servers = 8 pm.min_spare_servers = 8 pm.max_spare_servers = 12 pm.process_idle_timeout = 10s; pm.max_requests = 0 pm.status_path = /status |
We have set pm = on demand
instead of default. WordPress Plugins can easily east 40 Mb per PHP page request, we can calculate the server max_children
value in this way : 2048 MB (set RAM for PHP) divided by 15. Otherwise we might face out of memory (OOM). You can set pm.max_requests = 500
for a decent control. The example is full all values because you might change ondemand
to dynamic
…
After Nginx microcache is ready, you will get an idea. Usually max_children
10-15 is commonly used. Rule is that, value of pm.min_spare_servers
and pm.max_spare_servers
cannot be greater than pm.max_children
. Also, pm.start_servers
must not be less than pm.min_spare_servers
and not greater than pm.max_spare_servers
.
ondemand
works better than dynamic
(Default). In this case, pre-forking of PHP-FPM process will happen only on demand. You can adjust the values as per your need. You can try with static
too. This will definitely not satisfy you. Actually you need to test a lot, for example this :
A bit SSL optimization will be better than thinking about www.conf
. It is better to test with Google AdSense free webpages. Google has very pathetic performing CDNs.