Linux下使用Speedtest測(cè)試網(wǎng)速的方法
Speedtest是用來(lái)測(cè)試網(wǎng)絡(luò)性能的開(kāi)源軟件,在Linux下面安裝Speedtest可以用來(lái)測(cè)試網(wǎng)絡(luò)出口的上傳和下載速度,幫助排查網(wǎng)絡(luò)方面導(dǎo)致的故障。

Speedtest介紹
由于公司幾個(gè)項(xiàng)目用戶訪問(wèn)的時(shí)候響應(yīng)較慢,項(xiàng)目本身沒(méi)問(wèn)題,服務(wù)及調(diào)用的接口返回信息都比較正常,猜想是網(wǎng)絡(luò)方面造成的瓶頸,導(dǎo)致用戶請(qǐng)求的時(shí)候網(wǎng)絡(luò)響應(yīng)堵塞,拉長(zhǎng)了響應(yīng)時(shí)間。
Speedtest.net是比較廣泛的用來(lái)測(cè)試寬帶速度的網(wǎng)站,Speedtest.net的工作原理并不復(fù)雜:它在你的瀏覽器中加載JavaScript代碼并自動(dòng)檢測(cè)離你最近的Speedtest.net服務(wù)器,然后向服務(wù)器發(fā)送HTTP GET and POST請(qǐng)求來(lái)測(cè)試上行/下行網(wǎng)速。
但在沒(méi)有圖形化桌面時(shí)(例如,當(dāng)你通過(guò)命令行遠(yuǎn)程登陸服務(wù)器或使用沒(méi)有圖形界面的操作系統(tǒng)),基于flash、界面友好的Speedtest.net將無(wú)法工作。幸運(yùn)的是,Speedtest.net提供了一個(gè)命令行版本——speedtest-cli。下面我將向你演示如何在Linux的命令行中使用speedtest-cli來(lái)測(cè)試寬帶連接速度。
安裝speedtest-cli
Github鏈接:https://github.com/sivel/speedtest-cli
Speendtest.net官網(wǎng):http://www.speedtest.net/
測(cè)試本機(jī)所在網(wǎng)絡(luò)出口的帶寬,訪問(wèn)Speendtest.net,點(diǎn)擊首頁(yè)的Begin開(kāi)始測(cè)試,等待幾秒,查看測(cè)試結(jié)果:

pip安裝
speedtest是用python寫(xiě)的,沒(méi)使用過(guò)pip的需要先安裝pip,
pip安裝:https://pip.pypa.io/en/stable/installing/
#開(kāi)啟epel源
yum install python-pip –y
安裝speedtest-cli
pip install speedtest-cli
安裝完成測(cè)試
which speedtest-cli | bash –

github安裝
pip install git+https://github.com/sivel/speedtest-cli.git
或者
git clone https://github.com/sivel/speedtest-cli.git
python speedtest-cli/setup.py install
shell安裝
wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest_cli.py
chmod +x speedtest-cli
./speedtest-cli
speedtest-cli使用
speedtest-cli –h
/usr/bin/speedtest-cli –share
/usr/bin/speedtest-cli –list


版權(quán)聲明:本站文章來(lái)源標(biāo)注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請(qǐng)保持原文完整并注明來(lái)源及原文鏈接。禁止復(fù)制或仿造本網(wǎng)站,禁止在非maisonbaluchon.cn所屬的服務(wù)器上建立鏡像,否則將依法追究法律責(zé)任。本站部分內(nèi)容來(lái)源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來(lái),僅供學(xué)習(xí)參考,不代表本站立場(chǎng),如有內(nèi)容涉嫌侵權(quán),請(qǐng)聯(lián)系alex-e#qq.com處理。
關(guān)注官方微信