(转)使用Httperf 测试web 服务器性能
使用Httperf 测试web 服务器性能
Httperf服务器是hp使用的一款性能测试工具,我在shanghaionrails上见maxime使用,今天自己仔细使用了下,下面内容权当笔记
下载 -- http://www.hpl.hp.com/research/linux/httperf/
下载源码自己编译安装,没什么特殊参数
使用 httperf 参数
参数说明:
Server web服务地址
Rate 每秒请求数
Num-conn 连接数
Timout 超时
Num-call 每次连接发送的请求
下面我们来试试sohu
httperf --server sohu.com --num-conn 300 --rate 30
httperf --client=0/1 --server=sohu.com --port=80 --uri=/ --rate=30 --send-buffer=4096 --recv-buffer=16384 --num-conns=300 --num-calls=1
Maximum connect burst length: 1
Total: connections 300 requests 300 replies 300 test-duration 11.032 s
Connection rate: 27.2 conn/s (36.8 ms/conn, <=7 concurrent connections)
Connection time [ms]: min 53.3 avg 116.9 max 3067.6 median 65.5 stddev 384.6
Connection time [ms]: connect 53.2
Connection length [replies/conn]: 1.000
Request rate: 27.2 req/s (36.8 ms/req)
Request size [B]: 61.0
Reply rate [replies/s]: min 29.0 avg 29.5 max 30.0 stddev 0.7 (2 samples)
Reply time [ms]: response 63.7 transfer 0.0
Reply size [B]: header 198.0 content 0.0 footer 0.0 (total 198.0)
Reply status: 1xx=0 2xx=0 3xx=300 4xx=0 5xx=0
CPU time [s]: user 0.30 system 10.62 (user 2.7% system 96.2% total 99.0%)
Net I/O: 6.9 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
我们的测试的是300个请求,每秒30个。从返回信息可以看出
Reply rate [replies/s]: min 29.0 avg 29.5 max 30.0 stddev 0.7 (2 samples)
每秒的最大可回应请求数30.0
Connection rate: 27.2 conn/s (36.8 ms/conn, <=7 concurrent connections)
最大并发数为 7
Reply time [ms]: response 63.7 transfer 0.0
平均响应时间为63.7毫秒
下面一样的测试条件,我们来试试新浪
httperf --server sina.com.cn --num-conn 300 --rate 30
httperf --client=0/1 --server=sina.com.cn --port=80 --uri=/ --rate=30 --send-buffer=4096 --recv-buffer=16384 --num-conns=300 --num-calls=1
Maximum connect burst length: 1
Total: connections 300 requests 300 replies 300 test-duration 10.687 s
Connection rate: 28.1 conn/s (35.6 ms/conn, <=5 concurrent connections)
Connection time [ms]: min 34.0 avg 98.7 max 4073.1 median 57.5 stddev 314.3
Connection time [ms]: connect 28.9
Connection length [replies/conn]: 1.000
Request rate: 28.1 req/s (35.6 ms/req)
Re.scrollTo(editor.bbcode_editor.textarea.element);} }); } new WeiboShare({share_buttons: $('share_weibo'), img_scope: $('blog_content')});