阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

用httping测试web页面响应时间

456次阅读
没有评论

共计 3400 个字符,预计需要花费 9 分钟才能阅读完成。

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

用 httping 测试 web 页面响应时间

在 FreeBSD 下安装

#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 http://localhost/)
-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]  bind to ip-address (and thus interface) [/port]
-q              quiet, only returncode
-V              show the version

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

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

#httping -c10 -g http://www.sina.com.cn

PING www.sina.com.cn:80 (http://www.sina.com.cn):
connected to www.sina.com.cn:80, seq=0 time=8.76 ms
connected to www.sina.com.cn:80, seq=1 time=4.81 ms
connected to www.sina.com.cn:80, seq=2 time=5005.72 ms
connected to www.sina.com.cn:80, seq=3 time=6204.22 ms
connected to www.sina.com.cn:80, seq=4 time=5.45 ms
connected to www.sina.com.cn:80, seq=5 time=5.63 ms
connected to www.sina.com.cn:80, seq=6 time=7.44 ms
connected to www.sina.com.cn:80, seq=7 time=5006.06 ms
connected to www.sina.com.cn:80, seq=8 time=5.16 ms
connected to www.sina.com.cn:80, seq=9 time=5.01 ms
— http://www.sina.com.cn 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 http://www.linuxidc.com

PING www.linuxidc.com:80 (http://www.linuxidc.com):
connected to www.linuxidc.com:80, seq=0 time=17.11 ms
connected to www.linuxidc.com:80, seq=1 time=23.52 ms
connected to www.linuxidc.com:80, seq=2 time=18.72 ms
connected to www.linuxidc.com:80, seq=3 time=19.37 ms
connected to www.linuxidc.com:80, seq=4 time=107.02 ms
connected to www.linuxidc.com:80, seq=5 time=19.70 ms
connected to www.linuxidc.com:80, seq=6 time=31.35 ms
connected to www.linuxidc.com:80, seq=7 time=21.85 ms
connected to www.linuxidc.com:80, seq=8 time=19.67 ms
connected to www.linuxidc.com:80, seq=9 time=19.52 ms
— http://www.linuxidc.com 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

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

可以用 shell 直接取到这个值得

#httping -c5 -g http://www.linuxidc.com | tail -n1 | awk ‘{print $4}’ | cut -d/ -f2

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

httping 的详细介绍:请点这里
httping 的下载地址:请点这里

正文完
星哥玩云-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-20发表,共计3400字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中

星哥玩云

星哥玩云
星哥玩云
分享互联网知识
用户数
4
文章数
19350
评论数
4
阅读量
7954089
文章搜索
热门文章
星哥带你玩飞牛NAS-6:抖音视频同步工具,视频下载自动下载保存

星哥带你玩飞牛NAS-6:抖音视频同步工具,视频下载自动下载保存

星哥带你玩飞牛 NAS-6:抖音视频同步工具,视频下载自动下载保存 前言 各位玩 NAS 的朋友好,我是星哥!...
星哥带你玩飞牛NAS-3:安装飞牛NAS后的很有必要的操作

星哥带你玩飞牛NAS-3:安装飞牛NAS后的很有必要的操作

星哥带你玩飞牛 NAS-3:安装飞牛 NAS 后的很有必要的操作 前言 如果你已经有了飞牛 NAS 系统,之前...
我把用了20年的360安全卫士卸载了

我把用了20年的360安全卫士卸载了

我把用了 20 年的 360 安全卫士卸载了 是的,正如标题你看到的。 原因 偷摸安装自家的软件 莫名其妙安装...
再见zabbix!轻量级自建服务器监控神器在Linux 的完整部署指南

再见zabbix!轻量级自建服务器监控神器在Linux 的完整部署指南

再见 zabbix!轻量级自建服务器监控神器在 Linux 的完整部署指南 在日常运维中,服务器监控是绕不开的...
飞牛NAS中安装Navidrome音乐文件中文标签乱码问题解决、安装FntermX终端

飞牛NAS中安装Navidrome音乐文件中文标签乱码问题解决、安装FntermX终端

飞牛 NAS 中安装 Navidrome 音乐文件中文标签乱码问题解决、安装 FntermX 终端 问题背景 ...
阿里云CDN
阿里云CDN-提高用户访问的响应速度和成功率
随机文章
浏览器自动化工具!开源 AI 浏览器助手让你效率翻倍

浏览器自动化工具!开源 AI 浏览器助手让你效率翻倍

浏览器自动化工具!开源 AI 浏览器助手让你效率翻倍 前言 在 AI 自动化快速发展的当下,浏览器早已不再只是...
【开源神器】微信公众号内容单篇、批量下载软件

【开源神器】微信公众号内容单篇、批量下载软件

【开源神器】微信公众号内容单篇、批量下载软件 大家好,我是星哥,很多人都希望能高效地保存微信公众号的文章,用于...
星哥带你玩飞牛NAS-4:飞牛NAS安装istore旁路由,家庭网络升级的最佳实践

星哥带你玩飞牛NAS-4:飞牛NAS安装istore旁路由,家庭网络升级的最佳实践

星哥带你玩飞牛 NAS-4:飞牛 NAS 安装 istore 旁路由,家庭网络升级的最佳实践 开始 大家好我是...
支付宝、淘宝、闲鱼又双叕崩了,Cloudflare也瘫了连监控都挂,根因藏在哪?

支付宝、淘宝、闲鱼又双叕崩了,Cloudflare也瘫了连监控都挂,根因藏在哪?

支付宝、淘宝、闲鱼又双叕崩了,Cloudflare 也瘫了连监控都挂,根因藏在哪? 最近两天的互联网堪称“故障...
零成本上线!用 Hugging Face免费服务器+Docker 快速部署HertzBeat 监控平台

零成本上线!用 Hugging Face免费服务器+Docker 快速部署HertzBeat 监控平台

零成本上线!用 Hugging Face 免费服务器 +Docker 快速部署 HertzBeat 监控平台 ...

免费图片视频管理工具让灵感库告别混乱

一言一句话
-「
手气不错
星哥带你玩飞牛NAS-16:飞牛云NAS换桌面,fndesk图标管理神器上线!

星哥带你玩飞牛NAS-16:飞牛云NAS换桌面,fndesk图标管理神器上线!

  星哥带你玩飞牛 NAS-16:飞牛云 NAS 换桌面,fndesk 图标管理神器上线! 引言 哈...
星哥带你玩飞牛NAS硬件02:某鱼6张左右就可拿下5盘位的飞牛圣体NAS

星哥带你玩飞牛NAS硬件02:某鱼6张左右就可拿下5盘位的飞牛圣体NAS

星哥带你玩飞牛 NAS 硬件 02:某鱼 6 张左右就可拿下 5 盘位的飞牛圣体 NAS 前言 大家好,我是星...
星哥带你玩飞牛NAS-11:咪咕视频订阅部署全攻略

星哥带你玩飞牛NAS-11:咪咕视频订阅部署全攻略

星哥带你玩飞牛 NAS-11:咪咕视频订阅部署全攻略 前言 在家庭影音系统里,NAS 不仅是存储中心,更是内容...
星哥带你玩飞牛NAS硬件 01:捡垃圾的最爱双盘,暴风二期矿渣为何成不老神话?

星哥带你玩飞牛NAS硬件 01:捡垃圾的最爱双盘,暴风二期矿渣为何成不老神话?

星哥带你玩飞牛 NAS 硬件 01:捡垃圾的最爱双盘,暴风二期矿渣为何成不老神话? 前言 在选择 NAS 用预...
你的云服务器到底有多强?宝塔跑分告诉你

你的云服务器到底有多强?宝塔跑分告诉你

你的云服务器到底有多强?宝塔跑分告诉你 为什么要用宝塔跑分? 宝塔跑分其实就是对 CPU、内存、磁盘、IO 做...