介绍一个专业的网络测速工具speedtest https://www.speedtest.net/,国内有对应站点 http://www.speedtest.cn/
下载和上传
网络数据传输分为发送数据和接收数据两部分。上传就是向外部发送数据,下载为从外部接收数据。它们都受网络带宽和设备性能制约。 在日常网络传输中大致1Mbps=125KB/s(1:8换算)。1M宽带即指1Mbps=1000Kbps=1000/8KBps=125KBps; 因此1M的带宽下载的速度一般不会超过125KB每秒。例如上行的网络带宽为100Mbps,那么最大上传速度就是12500KB/s,也就是12.5MB/s。
用户申请的宽带业务速率指技术上所能达到的最大理论速率值,用户上网时还受到用户电脑软硬件的配置、所浏览网站的位置、对端网站带宽等情况的影响,故用户上网时的速率通常低于理论速率值。 理论上:2M(即2Mb/s)宽带理论速率是:256KB/s(即256*8=2048Kb/s),实际速率大约为103–200kB/s;4M(即4Mb/s)的宽带理论速率是:512KB/s,实际速率大约为200—440kB/s。
安装
pip install speedtest-cli
或者下载这个文件 https://raw.github.com/sivel/speedtest-cli/master/speedtest.py
修改文件名为 speed-cli即可。1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50λ speed-cli -h
usage: speed-cli.py [-h] [--no-download] [--no-upload] [--single] [--bytes]
[--share] [--simple] [--csv]
[--csv-delimiter CSV_DELIMITER] [--csv-header] [--json]
[--list] [--server SERVER] [--exclude EXCLUDE]
[--mini MINI] [--source SOURCE] [--timeout TIMEOUT]
[--secure] [--no-pre-allocate] [--version]
Command line interface for testing internet bandwidth using speedtest.net.
--------------------------------------------------------------------------
https://github.com/sivel/speedtest-cli
optional arguments:
-h, --help show this help message and exit
--no-download Do not perform download test
--no-upload Do not perform upload test
--single Only use a single connection instead of multiple. This
simulates a typical file transfer.
--bytes Display values in bytes instead of bits. Does not
affect the image generated by --share, nor output from
--json or --csv
--share Generate and provide a URL to the speedtest.net share
results image, not displayed with --csv
--simple Suppress verbose output, only show basic information
--csv Suppress verbose output, only show basic information
in CSV format. Speeds listed in bit/s and not affected
by --bytes
--csv-delimiter CSV_DELIMITER
Single character delimiter to use in CSV output.
Default ","
--csv-header Print CSV headers
--json Suppress verbose output, only show basic information
in JSON format. Speeds listed in bit/s and not
affected by --bytes
--list Display a list of speedtest.net servers sorted by
distance
--server SERVER Specify a server ID to test against. Can be supplied
multiple times
--exclude EXCLUDE Exclude a server from selection. Can be supplied
multiple times
--mini MINI URL of the Speedtest Mini server
--source SOURCE Source IP address to bind to
--timeout TIMEOUT HTTP timeout in seconds. Default 10
--secure Use HTTPS instead of HTTP when communicating with
speedtest.net operated servers
--no-pre-allocate Do not pre allocate upload data. Pre allocation is
enabled by default to improve upload performance. To
support systems with insufficient memory, use this
option to avoid a MemoryError
--version Show the version number and exit
使用
1 | λ speed-cli --share |
我电脑下载速度 18.58 Mbit/s,在网站 https://cn.office-converter.com/Bandwidth-3 换算下就是2.32MB/s
生成的图片地址http://www.speedtest.net/result/8272084022.png 可以分享给他人。
装逼测速
看别人分享的网速比自己快那么多,想盘他们怎么办?用speedtest-fake1
2
3
4
5
6
7
8
9
10λ php speedtest.php
Retrieving speedtest.net configuration...
Testing from China Telecom Guangdong (183.15.xxx.xx)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by W Professional Services Limited (New Territories) [18.14 km]: 43.12 ms
Testing download speed................................................................................
Download: 14770.61 Mbit/s
Testing upload speed................................................................................................
Upload: 10512.14 Mbit/s
14770.61 Mbit/s 够装逼用了,当然这个只能截图了。
公众号:苏生不惑