Bad perfomance with nginx and php-fpm

Jérôme Loyet jerome at loyet.net
Thu Nov 17 17:54:24 UTC 2011


2011/11/17 Dieter Knopf <dieterknopf at googlemail.com>
>
> Hello,
>
> i'm trying to install nginx with php-fpm. It works, but it's not
> really fast and i have problems with multiple connections.
>
> Versions:
> nginx: nginx version: nginx/1.0.10
> PHP 5.3.8-1~dotdeb.2 (fpm-fcgi) (built: Aug 25 2011 13:36:54)
>
> Configs:
> VHost:
> [...]
> location ~ \.php$ {
>  fastcgi_index index.php;
>  include /etc/nginx/fastcgi_params;
>  fastcgi_param  SCRIPT_FILENAME /web$fastcgi_script_name;
>  fastcgi_pass unix:/tmp/foo.socket;
> }
> [...]
>
> php5-fpm:
> [...]
> listen = '/tmp/foo.socket'
> user = foo
> group = foo
> pm = dynamic

can you test by setting pm = static and pm.max_children to something a
little bit hight than 10 (12 or 15).
Just to ensure the problem does not come from the dynamic PM.

> pm.max_children = 10
> pm.start_servers = 2
> pm.min_spare_servers = 1
> pm.max_spare_servers = 3
> chroot = /var/www/foo/
> chdir = /web/
> [...]
>
> fastcgi_params:
> [...]
> fastcgi_connect_timeout 60;
> fastcgi_send_timeout 180;
> fastcgi_read_timeout 180;
> fastcgi_buffer_size 128k;
> fastcgi_buffers 4 256k;
> fastcgi_busy_buffers_size 256k;
> fastcgi_temp_file_write_size 256k;
> fastcgi_intercept_errors on;
> [...]
>
> I installed a fresh Wordpress without any plugins on the page and
> tried ApacheBench with -n 1000 -c 10 on it:
>
> Time taken for tests:   25.860 seconds
> Complete requests:      1000
> Failed requests:        875
>   (Connect: 0, Receive: 0, Length: 875, Exceptions: 0)
>
> The same page on a standard apache setup spawns 10x php5-cgi:
>
> Time taken for tests:   104.929 seconds
> Complete requests:      1000
> Failed requests:        0
>
>
> Not sure what's wrong :-(
>
> Thanks
>
> Dieter
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx



More information about the nginx mailing list