Speedtest是用來測試網絡性能的開源軟件,在Linux下面安裝Speedtest能夠用來測試網絡出口的上傳和下載速度,幫助排查網絡方面致使的故障。python
因爲公司幾個項目用戶訪問的時候響應較慢,項目自己沒問題,服務及調用的接口返回信息都比較正常,猜測是網絡方面形成的瓶頸,致使用戶請求的時候網絡響應堵塞,拉長了響應時間。linux
Speedtest.net是比較普遍的用來測試寬帶速度的網站,Speedtest.net的工做原理並不複雜:它在你的瀏覽器中加載JavaScript代碼並自動檢測離你最近的Speedtest.net服務器,而後向服務器發送HTTP GET and POST請求來測試上行/下行網速。git
但在沒有圖形化桌面時(例如,當你經過命令行遠程登錄服務器或使用沒有圖形界面的操做系統),基於flash、界面友好的Speedtest.net將沒法工做。幸運的是,Speedtest.net提供了一個命令行版本——speedtest-cli。下面我將向你演示如何在Linux的命令行中使用speedtest-cli來測試寬帶鏈接速度。github
Github連接:https://github.com/sivel/speedtest-cli
Speendtest.net官網:http://www.speedtest.net/
測試本機所在網絡出口的帶寬,訪問Speendtest.net,點擊首頁的Begin開始測試,等待幾秒,查看測試結果:shell
speedtest是用python寫的,沒使用過pip的須要先安裝pip,瀏覽器
pip安裝:https://pip.pypa.io/en/stable/installing/
#開啓epel源bash
yum install python-pip –y
pip install speedtest-cli
安裝完成測試服務器
which speedtest-cli | bash –
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
wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest_cli.py chmod +x speedtest-cli ./speedtest-cli
speedtest-cli –h /usr/bin/speedtest-cli –share /usr/bin/speedtest-cli –list
免費提供最新Linux技術教程書籍,爲開源技術愛好者努力作得更多更好:https://www.linuxprobe.com/性能