I switched from common LAMP stack (Linux+Apache+MySQL+PHP) to nginx + PHP-FPM mostly because of the speed. The speed increase is incredible - not measured but it looks like for a project using both Zend (old libraries) and Zend 2 (new apps) for backend and Bootstrap + CoffeeScript + Backbone.js on the frontend the site renders 2 to 3 times faster!
The only drawback is for pages on which too many concurrent AJAX requests are called. Most of the times one page calls up to 5 different AJAX requests to load data on render but few of them require even 10 to 20 concurrent requests. In this case the rendering is slowed down 2 to 4 times when compared to rendering on Apache (comparison could now be done only on two different servers while the one running Apache is older and overall slower - but it can render pages with many concurrent AJAX requests much quicker).
This is my PHP-FPM configuration (regarding the pool manager):
pm = dynamic
pm.max_children = 20
pm.start_servers = 3
pm.min_spare_servers = 2
pm.max_spare_servers = 4
Increasing pm.max_children
to 40
doesn't seem to have any influence on the speed though after changing from the default value 5
to current 20
I could see some speed increase.
I have also increased the worker_processes
for nginx to value 4
(number of the cores) while keeping the worker_connections
on the default 1024
value.
Is there anything else I should change in order to make the pages with more concurrent AJAX requests running much faster?