1、工具下载&&安装
软件获取 html
ftp://ftp.hpl.hp.com/pub/httperf/
这里使用的是以下的版本
ftp://ftp.hpl.hp.com/pub/httperf/httperf-0.9.0.tar.gz
软件安装
# ls httperf-0.9.0.tar.gz
httperf-0.9.0.tar.gz
#tar zxvf httperf-0.9.0.tar.gz && cd httperf-0.9.0 &&./configure --prefix=/usr/local/tools && make && make install
2、开始压力测试
[root@localhost bin]# ./httperf --client=0/1 --server www.ethnicity.cn --port80 --uri /index.html --rate 100 --num-conn 300 --num-call 5 --timeout 5 网络
--client=I/N 指定当前客户端I,是N个客户端中的第几个。用于多个客户端发请求,但愿确保每一个客户端发的请求不是彻底一致。通常不用指定并发
--server 所测试的的网站名(主机名,域名或者ip地址)socket
--uri 指定的下载文件工具
--rate 每秒发送的请求测试
--num-conn 链接的总数网站
--num-call 每一个链接发送的请求数目spa
--timeout 超时时间server
httperf --timeout=5 --client=0/1--server=www.ethnicity.cn --port=80 --uri=/index.html --rate=100 --send-buffer=4096--recv-buffer=16384 --num-conns=300 --num-calls=5
Maximum connect burst length: 13htm
最大并发链接数:13
Total: connections 300 requests 1475 replies 1475test-duration 6.204 s
一共300个链接,1475个请求,应答了1475个,测试耗时:6.204秒
Connection rate: 48.4 conn/s (20.7 ms/conn, <=189concurrent connections)
链接速率:48.4个每秒(每一个链接耗时20.7 ms, 小于指定的300个并发链接)
Connection time [ms]: min 663.4 avg 1937.6 max 3808.4median 1720.5 stddev 964.7
链接时间(微秒):最小663.4,平均1937.6,最大3808.4,中位数 1720.5, 标准误差964.7
Connection time [ms]: connect 1098.4
链接时间(微秒):链接1098.4
Connection length [replies/conn]: 5.000
链接长度(应答/链接):5.000
Request rate: 237.7 req/s (4.2 ms/req)
请求速率:237.7(pqs),每一个请求4.2 ms
Request size : 79.0
链接长度(应答/链接): 79.0
Reply rate [replies/s]: min 268.8 avg 268.8 max 268.8stddev 0.0 (1 samples)
响应速率(响应个数/秒):最小268.8, 平均268.8,最大268.8,标准误差 0.0(一个例样)
Reply time [ms]: response 80.7 transfer 87.2
响应时间(微妙):响应80.7,传输87.2
Reply size : header 283.0 content 21895.0 footer 0.0(total 22178.0)
应包长度(字节):响应头283.0 内容:21895.0 响应末端 -0.0(总共22178.0)
Reply status: 1xx=0 2xx=1475 3xx=0 4xx=0 5xx=0
响应包状态: 2xx 有1475个,其余没有
CPU time [s]: user 0.45 system 5.48 (user 7.3% system88.3% total 95.6%)
CPU时间(秒): 用户0.45 系统5.48(用户占了7.3% 系统占88.3% 总共95.6%)
Net I/O: 5167.4 KB/s (42.3*10^6 bps)
网络I/O:5167.4 KB/s
Errors: total 5 client-timo 5 socket-timo 0 connrefused 0connreset 0
错误:总数5 客户端超时5 套接字超时0 链接拒绝0 链接重置0
Errors: fd-unavail 0 addrunavail 0 ftab-full 0 other 0
错误:fd不正确0 地址不正确0 ftab占满0其余0