ab(Apache Benchmark)运行apr_socket_recv报错

 伦理片 http://www.dotdy.com/

在Mac OS X Lion下运行ab会报如下错误:

apr_socket_recv: Connection reset by peer (54)

比如:

$ ab -n 1000 -c 10 http://localhost:8888/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
 
Benchmarking localhost (be patient)
Send request failed!
Send request failed!
Send request failed!
apr_socket_recv: Connection reset by peer (54)

新版的Apache已经解决了这个问题,可以获取源代码并编译如下:

wget http://mirrors.kahuki.com/apache//httpd/httpd-2.3.16-beta.tar.bz2
tar jxvf httpd-2.3.16-beta.tar.bz2 
cd httpd-2.3.16
./configure

我只需要一个ab,所以只编译support目录即可。

cd support
make
#...

重新运行ab

./ab -n 1000 -c 10 http://localhost:8888/

Bingo! :)

对于老一些的版本的Apache,需要打补丁

wget https://www.rtfm.ro/download/patches/ab.patch --no-check-certificate
patch -p0 < ./ab.patch

会有一行出错,不要理,继续往下走。

patching file support/ab.c
Hunk #1 FAILED at 670.
Hunk #2 FAILED at 1683.
Hunk #3 FAILED at 1767.
3 out of 3 hunks FAILED -- saving rejects to file support/ab.c.rej

然后按前面的步骤编译Apache的support目录。


©️2020 CSDN 皮肤主题: 大白 设计师: CSDN官方博客 返回首页
实付0元
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值