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.

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 answer on Server Fault.

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