httping:测量网站延迟

遇到网络问题的时候,我们一般会先通过 ping 这个工具来了解基本的情况。httping 与 ping 类似,不过它不是发送 ICMP 请求,而是发送 HTTP 请求。利用 httping,我们可以测量出 Web 服务器跟网络的延迟。

 

安装

apt-get install httping # Debian/Ubuntu
yum install httping     # Fedora/CentOS/RHEL
yaourt -S httping       # Arch Linux
emerge -av httping      # Funtoo/Gentoo


使用

假如我们想测测 www.linux.com,那么可以执行:

linux@linux:~$ httping -c10 -g http://www.linux.com
PING www.linux.com:80 (/):
connected to 61.155.222.134:80 (307 bytes), seq=0 time=207.10 ms
connected to 61.155.222.134:80 (307 bytes), seq=1 time= 84.88 ms
connected to 61.155.222.164:80 (307 bytes), seq=2 time=1174.91 ms
connected to 61.155.222.134:80 (307 bytes), seq=3 time=693.06 ms
connected to 61.155.222.134:80 (307 bytes), seq=4 time=1328.15 ms
connected to 61.155.222.134:80 (331 bytes), seq=5 time=10792.71 ms
connected to 61.155.222.134:80 (327 bytes), seq=6 time=880.24 ms
connected to 61.155.222.134:80 (327 bytes), seq=7 time=1115.27 ms
connected to 61.155.222.164:80 (327 bytes), seq=8 time= 62.34 ms
connected to 61.155.222.164:80 (327 bytes), seq=9 time= 62.49 ms
--- http://www.linux.com/ ping statistics ---
10 connects, 10 ok, 0.00% failed, time 26456ms
round-trip min/avg/max = 62.3/1640.1/10792.7 ms
linux@linux:~$


简单介绍一下这里用到的选项:

g:要测量的网址
-l:使用 SSL 连接
-c:这个和 ping 一样,为请求数量
-Y:启用颜色输出


httping 还支持 IPv6、代理、超时、请求头等其他特性,详情可以通过 man httping 查询。值得一提的是,httping 也有 Android 版本,有需要有朋友可通过 Google Play 获取。

httping:https://www.vanheusden.com/httping/

httping-2.4.tgz:https://www.vanheusden.com/httping/httping-2.4.tgz

 

参考文章:http://www.linuxdiyf.com/linux/20762.html

posted @ 2017-05-04 10:03  Oops!#  阅读(1352)  评论(0编辑  收藏  举报