PHP-FPM very slow

Carma asked:

i have a little problem with nginx and php7.0-fpm. I have much less requests per second than apache + mod_php.

For example (same server)

ab tests

Requested script in tests is simple echo.


nginx conf & www.conf & php.ini


if is use apache with fast=cgi module instead mod_php module i will get same result than nginx + fast-cgi (30r./s.). Is problem in php-fpm?

Where could be the problem?

My answer:

Your tests are not on similarly configured servers.

Your Apache server served all its requests with keepalives enabled, but your nginx server served all its requests with keepalives disabled, which creates a significant reduction in performance as a new TCP connection must be opened for every request.

By default, nginx has keepalives enabled, so you must have explicitly disabled them somehow. Inspect your nginx configuration carefully and remove any directives related to keepalive, so that nginx uses its default behavior. Then try your benchmark again.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.