Bad perfomance with nginx and php-fpm

Dieter Knopf dieterknopf at googlemail.com
Thu Nov 17 16:50:05 UTC 2011


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
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



More information about the nginx mailing list