如何测速

不同的线路对于网速差别极大,一般来说,距离越远,延时越大

在线测速

参考:Vultr 测速方法

speedtest

Ping检测

vultr 测速

命令行测速

ping

参考:Calculate upload/download speed by ping

$ ping 149.28.83.99
PING 149.28.83.99 (149.28.83.99) 56(84) bytes of data.
64 bytes from 149.28.83.99: icmp_seq=1 ttl=45 time=187 ms
64 bytes from 149.28.83.99: icmp_seq=2 ttl=45 time=187 ms
64 bytes from 149.28.83.99: icmp_seq=3 ttl=45 time=187 ms
64 bytes from 149.28.83.99: icmp_seq=4 ttl=45 time=190 ms
64 bytes from 149.28.83.99: icmp_seq=5 ttl=45 time=186 ms
64 bytes from 149.28.83.99: icmp_seq=6 ttl=45 time=186 ms
64 bytes from 149.28.83.99: icmp_seq=7 ttl=45 time=187 ms
64 bytes from 149.28.83.99: icmp_seq=8 ttl=45 time=186 ms
64 bytes from 149.28.83.99: icmp_seq=9 ttl=45 time=188 ms
64 bytes from 149.28.83.99: icmp_seq=10 ttl=45 time=188 ms
64 bytes from 149.28.83.99: icmp_seq=11 ttl=45 time=187 ms
^C
--- 149.28.83.99 ping statistics ---
11 packets transmitted, 11 received, 0% packet loss, time 10011ms
rtt min/avg/max/mdev = 186.880/187.645/190.295/1.125 ms

发送64字节平均需要187.645毫秒,延时非常严重

speedtest-cli

参考:

speedtest-cli命令行下测试服务器外网速度

如何在Linux的终端测试网速

githubspeedtest的命令行版本

$ pip install speedtest-cli

测试网速

$ speedtest
Retrieving speedtest.net configuration...
Testing from UNICOM ZheJiang (101.68.71.72)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by Hangzhou , Zhejiang Unicom (Hangzhou) [4.91 km]: 2.893 ms
Testing download speed................................................................................
Download: 51.89 Mbit/s
Testing upload speed......................................................................................................
Upload: 3.94 Mbit/s

测试服务器Zhejiang Unicom (Hangzhou),距离是4.91km,下载速度为51.89Mbit/s,上传速度为3.94Mbit/s

可以查找所有在美国的服务器

$ speedtest --list | grep -i america
8464) Bluesky Communications (Pago Pago, American Samoa) [8895.69 km]
20275) Blue Nap Americas (Willemstad, Curaçao) [15200.29 km]
16317) America Telecom (Macapa, Brazil) [16525.29 km]
3455) America Movil Peru SAC (Lima, Peru) [17321.89 km]
10275) Byteweb Telecom (Americana, Brazil) [18515.34 km]
18357) SIMNET (Americana, Brazil) [18515.34 km]
22460) NET Virtua (Americana, Brazil) [18515.34 km]
15091) SWISS-NET (Jardin America, Argentina) [19438.10 km]
...
...

指定服务器id进行测速,参数--share能够上传数据,生成一个数据图片

$ speedtest --server 16317 --share
Retrieving speedtest.net configuration...
Testing from UNICOM ZheJiang (101.68.71.72)...
Retrieving speedtest.net server list...
Retrieving information for the selected server...
Hosted by America Telecom (Macapa) [16525.29 km]: 354.928 ms
Testing download speed................................................................................
Download: 17.64 Mbit/s
Testing upload speed...............81.8M...........................................................................
Upload: 16.45 Mbit/s81.8M
Share results: http://www.speedtest.net/result/8068095904.png