1, 使用默认安装的ab工具并发稍微一大就出“apr_socket_recv: Connection reset by peer (104)” 错误, google了一把找了到一篇博客《apache ab stress tool “apr_socket_recv: Connection reset by peer (104)” 的處理》,根据blog,下载最新的apache http server :http://httpd.apache.org/download.cgi#apache22, 修改support下面的ab.c源代码, 大概在
line 1369, 修改成
1368
return
;
1369 } else {
1370 //apr_err("apr_socket_recv", status);
1371 bad ++;
1372 close_connection (c ) ;
1373 return ;
1374 }
1369 } else {
1370 //apr_err("apr_socket_recv", status);
1371 bad ++;
1372 close_connection (c ) ;
1373 return ;
1374 }
然后编译安装
然后到安装目录下运行ab:
.
/ab
-n
1000
-c
1000
-C
auth_token=92dd856aacc414faf0dc5ed0bb61f5c3badd233e http:
//xxx.com
/
正常了
2, 但是
.
/ab
-n
10000
-c
2000
-C
auth_token=92dd856aacc414faf0dc5ed0bb61f5c3badd233e http:
//xxx.com
/
这时候出错了,“socket: Too many open files (24)” , 这个好办, 改一下系统的打开文件数的上限
$
sudo
su
# ulimit -n 30000
# ./ab -n 10000 -c 2000 -C auth_token=92dd856aacc414faf0dc5ed0bb61f5c3badd233e http://xxx.com/
# ulimit -n 30000
# ./ab -n 10000 -c 2000 -C auth_token=92dd856aacc414faf0dc5ed0bb61f5c3badd233e http://xxx.com/
ok了!~
reference:
apache ab stress tool “apr_socket_recv: Connection reset by peer (104)” 的處理 — 要翻GWF墙