Chinaunix首页 | 论坛 | 博客
  • 博客访问: 15055155
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: BSD

2008-11-04 10:27:22

性能测试是软件测试中很重要的工程工程,有时候我们需要测试的一项内容便是web页面,就是这样一种专门用来测试web页面响应时间的开源软件。

在下
引用
#cd /usr/ports/net/httping
#make install clean
#rehash


用法如下
引用
#httping -h



httping: option requires an argument -- h
HTTPing v1.2.6, (C) 2003-2008 folkert@vanheusden.com
SSL support included

-g url          url (e.g. -g
-h hostname     hostname (e.g. localhost)
-p portnr       portnumber (e.g. 80)
-x host:port    hostname+portnumber of proxyserver
-c count        how many times to connect
-i interval     delay between each connect
-t timeout      timeout (default: 30s)
-s              show statuscodes
-S             split time in connect-time and processing time
-G              do a GET request instead of HEAD (read the
                contents of the page as well)
-b              show transfer speed in KB/s (use with -G)
-B              like -b but use compression if available
-L x            limit the amount of data transferred (for -b)
                to 'x' (in bytes)
-X              show the number of KB transferred (for -b)
-l              connect using SSL
-z              show fingerprint (SSL)
-f              flood connect (no delays)
-a              audible ping
-m              give machine parseable output (see
                also -o and -e)
-o rc,rc,...    what http results codes indicate 'ok'
                coma seperated WITHOUT spaces inbetween
                default is 200, use with -e
-e str          string to display when http result code
                doesn't match
-I str          use 'str' for the UserAgent header
-R str          use 'str' for the Referer header
-r              resolve hostname only once (usefull when
                pinging roundrobin DNS: also takes the first
                DNS lookup out of the loop so that the first
                measurement is also correct)
-n warn,crit    Nagios-mode: return 1 when avg. response time
                >= warn, 2 if >= crit, otherwhise return 0
-N x            Nagios mode 2: return 0 when all fine, 'x'
                when anything failes
-y ip[:port]   to ip-address (and thus interface) [/port]
-q              quiet, only returncode
-V              show the version


每一个选项都有注释 比较好懂

下面就用他来测试本地到sina的页面响应时间吧,由于网络延时、堵塞等原因,可能出现不稳定的结果,测试10次取平均值

引用
#httping -c10 -g


PING(
connected to, seq=0 time=8.76 ms
connected to, seq=1 time=4.81 ms
connected to, seq=2 time=5005.72 ms
connected to, seq=3 time=6204.22 ms
connected to, seq=4 time=5.45 ms
connected to, seq=5 time=5.63 ms
connected to, seq=6 time=7.44 ms
connected to, seq=7 time=5006.06 ms
connected to, seq=8 time=5.16 ms
connected to, seq=9 time=5.01 ms
---ping statistics ---
10 connects, 10 ok, 0.00% failed
round-trip min/avg/max = 4.8/1625.8/6204.2 ms

平均值为1625.8ms,也就是1.63s

如果是测试本网段的某个主机,则测试结果就比较可以信任了
引用
#httping -c10 -g


PING(
connected to, seq=0 time=17.11 ms
connected to, seq=1 time=23.52 ms
connected to, seq=2 time=18.72 ms
connected to, seq=3 time=19.37 ms
connected to, seq=4 time=107.02 ms
connected to, seq=5 time=19.70 ms
connected to, seq=6 time=31.35 ms
connected to, seq=7 time=21.85 ms
connected to, seq=8 time=19.67 ms
connected to, seq=9 time=19.52 ms
---ping statistics ---
10 connects, 10 ok, 0.00% failed
round-trip min/avg/max = 17.1/29.8/107.0 ms
测试结果出来了
最小web页面响应时间:17.1  ms
平均web页面响应时间:29.8  ms
最大web页面响应时间:107.0 ms


一般来说 对我们有意义的数据是是平均值

可以用直接取到这个值得
引用
#httping -c5 -g| tail -n1 | awk '{print $4}' | cut -d/ -f2


还可以配合shell和rrdtool可以画出一张完美的web响应时间图来,还不错,^_^^_^

----------------------------------------EOF--------------------------------------------------------

作者:@
地址:

阅读(657) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~