您的位置:首页 > 理论基础 > 计算机网络

web压力测试工具httperf

2017-08-18 13:58 435 查看
Httperf是衡量Web服务器性能的工具。 它为生成各种HTTP工作负载和测量服务器性能提供了灵活的设施。

httperf的重点不在于实施一个特定的基准,而是提供一个强大的高性能工具,有助于构建微观和宏观层面的基准。

httperf的三个显着特点是其鲁棒性,其中包括生成和维持服务器超载,支持HTTP /

1.1和SSL协议的能力,以及对新工作负载生成器和性能测量的可扩展性

1.安装

$ wget ftp://ftp.hpl.hp.com/pub/httperf/httperf-0.9.0.tar.gz  (使用wget命令下载httperf压缩包)
$ tar zxvf httperf-0.9.0.tar.gz
$ cd httperf-0.9.0
$ ./configure --prefix=/usr/local/httperf
$ make && make install


2.使用方法:

httperf --client=0/1 --server=[YOUR_DOMAIN] -
port=443 --uri=/a.php --rate=100 --send-buffer=4096 -
-recv-buffer=16384 --ssl --num-conns=50 --num-
calls=1000


例样含义:

--client=I/N 指定当前客户端I,是N个客户端中的第几个。用于多个客户端发请求,希望确保每个客户端发的请求不是完全一致。一般不用指定
--server 请求的server名
--port 请求的端口号,默认为80,如果指定了--ssl为443
--uri 请求路径
--rate 指定一个固定速率来创建连接和会话
--num-conns 创建连接数
--num-call 每个连接发送多少请求
--send-buffer 指定发送http请求的最大buffer,默认为4K,一般不用指定
--recv-buffer 指定接受http请求的最大buffer,默认为16K,一般不用指定


比如我们测试新浪

httperf --client=0/1 --server sina.com.cn --num-conn
300 --rate 30


结果

Maximum connect burst length: 1

Total: connections 300 requests 300 replies 300 test-duration 12.459 s

Connection rate: 24.1 conn/s (41.5 ms/conn, <=52 concurrent connections)
Connection time [ms]: min 180.9 avg 734.9 max 7725.7 median 402.5 stddev 815.7
Connection time [ms]: connect 221.4
Connection length [replies/conn]: 1.000

Request rate: 24.1 req/s (41.5 ms/req)
Request size [B]: 64.0

Reply rate [replies/s]: min 26.2 avg 28.4 max 30.6 stddev 3.1 (2 samples)
Reply time [ms]: response 257.6 transfer 255.8
Reply size [B]: header 304.0 content 178.0 footer 0.0 (total 482.0)
Reply status: 1xx=0 2xx=0 3xx=300 4xx=0 5xx=0

CPU time [s]: user 1.19 system 11.27 (user 9.6% system 90.5% total 100.0%)
Net I/O: 12.8 KB/s (0.1*10^6 bps)

Errors: total 0 client-timo 0 socket-timo 0 connrefused 0 connreset 0
Errors: fd-unavail 0 addrunavail 0 ftab-full 0 other 0


结果分析:

Maximum connect burst length: 1
最大并发连接数:1
Total: connections 300 requests 300 replies 300 test-duration 12.459 s
一共300个连接,300个请求,应答了300个,测试耗时12.459s
Connection rate: 24.1 conn/s (41.5 ms/conn, <=52 concurrent connections)
连接速率:24.1个每秒(每个连接耗时41.5ms,小于指定的50个并发)
Connection time [ms]: min 180.9 avg 734.9 max 7725.7 median 402.5 stddev 815.7
连接时间(微妙):最小180.9,平均734.9,最大7752.7,中位数402.5,标准偏差815.7
Connection time [ms]: connect 221.4
连接时间(微妙):连接 221.4
Connection length [replies/conn]: 1.000
连接长度(应答/连接):1.000
Request rate: 24.1 req/s (41.5 ms/req)
请求速率:549.5(pqs),每个请求41.5ms
Request size [B]: 64.0
请求长度(字节):64.0
Reply rate [replies/s]: min 26.2 avg 28.4 max 30.6 stddev 3.1 (2 samples)
响应速率(响应个数/秒):最小26.2 ,平均28.4,最大30.6,标准偏差 3.1(2个例样)
Reply time [ms]: response 257.6 transfer 255.8
响应速率(微妙):响应25.5,传输61.0
Reply size [B]: header 304.0 content 178.0 footer 0.0 (total 482.0)
响应包长度(字节):响应头147.0,内容:178.0,响应末端2.0(总共53412.0)
Reply status: 1xx=0 2xx=0 3xx=300 4xx=0 5xx=0
响应包状态: 3xx 有300个,其他没有
CPU time [s]: user 1.19 system 11.27 (user 9.6% system 90.5% total 100.0%)
CPU时间(秒): 用户1.19 系统11.27(用户占了9.6    % 系统90.5% 总共100%)
Net I/O: 12.8 KB/s (0.1*10^6 bps)
网络I/O:12.8 KB/s (0.1*10^6 bps)
Errors: total 0 client-timo 0 socket-timo 0 connrefused 0 connreset 0
错误:总数 0 客户端超时0 套接字超时0 连接拒绝0 连接重置50
Errors: fd-unavail 0 addrunavail 0 ftab-full 0 other 0
错误:fd不正确0 地址不正确0 ftab占满0 其他0
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息