2021-05-12 14:32:11
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
vvvvvvvvvvvvv
vvvvv
使用
假如我們想測測 www.linuxidc.com,那麼可以執行:
linuxidc@linuxidc:~$ httping -c10 -g http://www.linuxidc.com
PING www.linuxidc.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.linuxidc.com/ ping statistics ---
10 connects, 10 ok, 0.00% failed, time 26456ms
round-trip min/avg/max = 62.3/1640.1/10792.7 ms
linuxidc@linuxidc:~$
簡單介紹一下這裡用到的選項:
g
:要測量的網址-l
:使用 SSL 連線-c
:這個和ping
一樣,為請求數量-Y
:啟用顏色輸出
httping 還支援 IPv6、代理、超時、請求頭等其他特性,詳情可以通過 man httping
查詢。值得一提的是,httping 也有 Android 版本,有需要有朋友可通過 Google Play 獲取。
→ httping
相關文章