2

G'day,

I'm running a FreeBSD box (9.1-RELEASE) with Nginx (1.2.7_1,1) and PHP-FPM (5.4.12). I'm having big problems with handling concurrent requests using Apache AB:

ab -n 10000 -c 500 http://10.128.28.164/index.php

The predominant error that I get in /var/log/httpd-error.log (in their thousands) is:

2013/03/08 11:11:10 [error] 99855#0: *44116 kevent() reported that connect() failed (54: Connection reset by peer) while connecting to upstream, client: 10.128.28.179, server: localhost, request: "GET /index.php HTTP/1.0", upstream: "fastcgi://10.128.28.164:9000", host: "10.128.28.164"

If I browse to the server (10.128.28.164) it works fine for HTML and PHP pages.

Any help would be amazing!!

Pete.

My php-fpm.conf file looks like this:

pid = run/php-fpm.pid
error_log = log/php-fpm.log
daemonize = yes
events.mechanism = kqueue

; Pool
[www]

user = www
group = www

listen = 10.128.28.164:9000

pm = dynamic
pm.max_children = 100
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
pm.max_requests = 100

My nginx.conf file looks like this:

worker_processes  4;

error_log  /var/log/httpd-error.log;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    access_log  /var/log/httpd-access.log;

    sendfile        on;

    keepalive_timeout  65;

    gzip  on;

    server {
        listen       10.128.28.164:80;
        server_name  localhost;

        root /usr/local/www;

        location ~ \.php$ {
            fastcgi_pass  10.128.28.164:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            fastcgi_param  PATH_INFO  $fastcgi_script_name;
            include        fastcgi_params;
        }

        location / {
            index  index.html;
        }
    }
}
Pete
  • 437
  • 4
  • 11

1 Answers1

1

Check dmesg for any kernel messages to the effect, the maximum number of network connections, or open files, or some other resource is exhausted (or rather, a limit is reached).

The log-message you quoted only tells the proxy's part of the story. Why it is the back-end is resetting connections, should be checked in the back-end's logs... For example, php-fpm may also be running out of the limit on file-descriptors per process -- so check your log/php-fpm.log for errors.

Mikhail T.
  • 3,043
  • 3
  • 29
  • 46