2013-03-08 137 views
2

天儿真好错误,的Nginx/PHP-FPM KEVENT()在压力测试

我运行一个FreeBSD盒(9.1-RELEASE)与Nginx的(1.2.7_1,1)和PHP-FPM(5.4 0.12)。我在与操作使用Apache AB并发请求的大问题:

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

的主要错误,我在/var/log/httpd-error.log获得(在成千上万)是:

2013/03/08 11:11:10 [error] 99855#0:* 44116 kevent()在连接到上游时报告connect()失败(54:由对等方重置连接),客户端:10.128.28.179,server:localhost,请求:“GET /index.php HTTP/1.0”,上行:“fastcgi://10.128.28.164:9000”,主机:“10.128.28.164”

如果我浏览到服务器(10.128.28.164)适用于HTML和PHP页面。

任何帮助将是惊人的!

皮特。

我的PHP-fpm.conf文件看起来像这样:

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 

我的nginx.conf文件看起来像这样:

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

回答

1

检查dmesg的任何内核消息的影响,最大网络连接数或打开的文件,或其他资源已耗尽(或者说,达到限制)。

您引用的日志消息仅告诉代理人的故事部分。为什么后端是重置连接,应该在后端的日志中检查......例如,php-fpm可能还会在每个进程的文件描述符的限制内运行 - 请检查您的日志/ php-fpm.log的错误。