httping测试WEB页面响应时间

上一篇 / 下一篇  2021-08-30 15:39:06

httping是一个用来测试 HTTP 请求的连接、发送请求、等待回应的时间。httping与ping类似,不过它不是发送ICMP请求,而是发送HTTP请求。利用httping,我们可以测量出Web服务器跟网络的延迟。httping项目地址:www.laoshoucun.com


httping安装

$ apt-getinstallhttping# Debian/Ubuntu
$yum install httping     # Fedora/CentOS/RHEL(EPEL源)
$yaourt -S httping       # Arch Linux
$emerge -av httping      # Funtoo/Gentoo
$brew install httping    # MAC

简单介绍一下几个常用的选项

-g 要测量的网址
-l 使用SSL连接
-c 这个和ping 一样,为请求数量
-Y 启用颜色输出
-x host:port(如果是测squid,用-x,不要用-h;和curl的不一样,curl -H指定的是发送的hostname,这个-h是指定给DNS解析的hostname)
-S 将时间分开成连接和传输两部分显示
-G GET(默认是HEAD)
-b 在使用了GET的前提下显示传输速度KB/s
-B 同-b,不过使用了压缩
-n a,b 提供给nagios监控用的,当平均响应时间>=a时,返回1;>=b,返回2;默认为0
-N c 提供给nagios监控用的,一切正常返回0,否则只要有失败的就返回c
-K 使用图形模式

httping使用

  • 测试http网站

$ httping -g blog.sina.com.cn/feirenraoyuan -c 5 -Y
PING hi-linux.com:80 (/):
connected to 23.91.98.188:80 (225 bytes), seq=0 time=391.34 ms 
connected to 23.91.98.188:80 (225 bytes), seq=1 time=456.97 ms 
connected to 23.91.98.188:80 (225 bytes), seq=2 time=472.89 ms 
connected to 23.91.98.188:80 (225 bytes), seq=3 time=289.64 ms 
connected to 23.91.98.188:80 (225 bytes), seq=4 time=180.28 ms 
--- http://hi-linux.com/ ping statistics ---
5 connects, 5 ok, 0.00% failed, time 6799ms
round-trip min/avg/max = 180.3/358.2/472.9 ms
  • 测试https网站

$ httping -g https://www.baidu.com  -c 5 -Y -l                                       
Auto enabling SSL due to https-URLPING www.baidu.com:443 (/):
connected to 220.181.112.244:443 (678 bytes), seq=0 time=164.95 ms 
connected to 220.181.112.244:443 (383 bytes), seq=1 time=142.61 ms 
connected to 220.181.112.244:443 (383 bytes), seq=2 time=166.66 ms 
connected to 220.181.112.244:443 (383 bytes), seq=3 time=139.77 ms 
connected to 220.181.112.244:443 (426 bytes), seq=4 time=164.19 ms 
--- https://www.baidu.com/ ping statistics ---
5 connects, 5 ok, 0.00% failed, time 5783ms
round-trip min/avg/max = 139.8/155.6/166.7 ms
  • 测试使用代理的网站

$ httping -x 10.1.2.210:1080 http://www.hi-linux.com/ -SGbs -c 5 
PING www.hi-linux.com:80 (/):
connected to www.hi-linux.com:80 (558 bytes), seq=0 time=   n/a+  0.61+  0.89+1914.14+  0.08=1915.63 ms 200 OK 90KB/s
connected to www.hi-linux.com:80 (558 bytes), seq=1 time=   n/a+  1.21+  2.51+1574.01+  0.09=1577.73 ms 200 OK 80KB/s
connected to www.hi-linux.com:80 (557 bytes), seq=2 time=   n/a+  1.21+  2.44+1396.79+  0.09=1400.44 ms 200 OK 90KB/s
connected to www.hi-linux.com:80 (557 bytes), seq=3 time=   n/a+  1.07+  2.57+4491.80+  0.13=4495.44 ms 200 OK 71KB/s
connected to www.hi-linux.com:80 (558 bytes), seq=4 time=   n/a+  1.08+  0.91+4535.66+  0.13=4537.65 ms 200 OK 22KB/s
--- http://www.hi-linux.com/ ping statistics ---
5 connects, 5 ok, 0.00% failed, time 18944ms
round-trip min/avg/max = 1400.4/2785.4/4537.6 ms
Transfer speed: min/avg/max = 22.674567/71.059180/90.632973 KB

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


TAG:

 

评分:0

我来说两句

日历

« 2024-05-05  
   1234
567891011
12131415161718
19202122232425
262728293031 

数据统计

  • 访问量: 3216
  • 日志数: 18
  • 建立时间: 2021-08-29
  • 更新时间: 2021-09-24

RSS订阅

Open Toolbar