压力测试中的Nginx/PHP-FPM kevent()错误
G'day 我正在用Nginx(1.2.7_1,1)和PHP-FPM(5.4.12)运行一个FreeBSD盒(9.1-RELEASE)。我在使用Apache AB处理并发请求时遇到了大问题:压力测试中的Nginx/PHP-FPM kevent()错误,nginx,freebsd,php,kqueue,Nginx,Freebsd,Php,Kqueue,G'day 我正在用Nginx(1.2.7_1,1)和PHP-FPM(5.4.12)运行一个FreeBSD盒(9.1-RELEASE)。我在使用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()报告连接到上游时conn
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,服务器: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
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;
}
}
}
我的nginx.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
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;
}
}
}
检查dmesg是否有任何内核消息,大意是网络连接的最大数量、打开的文件或某些其他资源已耗尽(或者达到限制) 您引用的日志消息仅说明代理的部分情况。为什么后端正在重置连接,应该在后端的日志中检查。。。例如,php fpm也可能超出了每个进程对文件描述符的限制——所以请检查日志/php-fpm.log中的错误