yum install gcc apr-devel apr-util-devel pcre-devel
wget https://mirrors.aliyun.com/apache/httpd/httpd-2.2.32.tar.gz
解压源码http,修改support/ab.c 1395行左右
} else {
1395 //apr_err("apr_socket_recv", status);
1396 bad++;
1397 close_connection(c);
1398 return;
1399 }
1400 }
./configure --prefix=/usr/local/apache
make
make完成后ab在边缘目录下:
./support/ab (或者 make install)
/usr/local/apache/bin/ab -n 10000 -c 1000 http://www.baidu.com/
Server Software: web服务器软件及版本
Server Hostname: 请求的地址
Server Port: 请求的端口
Document Path: 请求的页面路径
Document Length: 页面大小
Concurrency Level: 并发数
Time taken for tests: 测试总共花费的时间
Complete requests: 完成的请求数
Failed requests: 失败的请求数
Write errors: 写入错误
Total transferred: 总共传输字节数,包含http的头信息等
HTML transferred: html字节数,实际的页面传递字节数
Requests per second: 每秒处理的请求数,服务器的吞吐量(重要)
Time per request: 平均数,用户平均请求等待时间
Time per request: 服务器平均处理时间
Transfer rate: 平均传输速率(每秒收到的速率)
测试时出现的Failed requests原因分析:
Failed requests: 2303
(Connect: 0, Length: 2303, Exceptions: 0)
只要出现Failed requests就会多一行数据来统计失败的原因,分别有Connect、Length、Exceptions。
Connect 无法送出要求、目标主机连接失败、要求的过程中被中断。
Length 响应的内容长度不一致 ( 以 Content-Length 头值为判断依据 )。
Exception 发生无法预期的错误。