天天看點

網絡品質名額及測試工具iperf

網絡品質的名額,主要有以下幾個:

    A. 帶寬(throughput),網絡的吞吐率,端到端之間可以傳輸的最大速率。

    B. 延時(latency),資料包從本地傳輸到對端之間需要的時間,一般是來回的時間RTT。中美海底光纖RTT一般在170ms左右。

    C. 丢包(loss),丢包率超過10%以後,網絡品質會迅速劣化。

    D. 延時抖動(jitter),如果延時不穩定,忽快忽慢,網絡就存在抖動。在VOIP,視訊會議等場合,往往聲音和圖像也會抖動。

視訊直播對這四個名額都很敏感。基于UDP的srt協定直播,在部署前,需要确認網絡品質參數。

網絡品質測試工具iperf, 可以測試真實載荷下的網絡品質,可以測試端到端的網絡品質,可以測試一定吞吐率下的丢包、抖動。

iperf網站:https://iperf.fr/iperf-download.php

-b, --bitrate #[KMG][/#]  target bitrate in bits/sec (0 for unlimited)

-w, --window    #[KMG]    set window size / socket buffer size

-u, --udp                 use UDP rather than TCP

-c, --client    <host>    run in client mode, connecting to <host>

-s, --server              run in server mode

-D, --daemon              run the server as a daemon

-d, --dualtest           Do a bidirectional test simultaneously    // client only

-P, --parallel  #        number of parallel client threads to run

Source of the IPERF 3 project can be found at https://github.com/esnet/iperf

Source of the IPERF 2 project can be found at https://sourceforge.net/projects/iperf2/

Source of the IPERF project can be found at https://sourceforge.net/projects/iperf/

git clone [email protected]:esnet/iperf.git

不要用iperf3,直接用iperf2來測。

伺服器上啟動:# iperf -s -u -p 17029

windows client上面測試:

# iperf2 -u -c 107.150.28.246 -b 800k -i 5 -t 30  -p 17029

# iperf2 -u -c 107.150.28.246 -b 2M -i 5 -t 30 -p 17029

# iperf2 -u -c 107.150.28.246 -b 2.4M -i 5 -t 30 -p 17029

# iperf2 -u -c 107.150.28.246 -b 800k -i 5 -t 30  -p 17029 -P 3

# iperf2 -u -c 107.150.28.246 -b 800k -i 5 -t 30  -p 17029 -P 9

伺服器上面生成統計報告:

^C(cmm_owms) [[email protected] iperf2-code]# iperf -s -p 17029 -u

------------------------------------------------------------

Server listening on UDP port 17029

Receiving 1470 byte datagrams

UDP buffer size:  208 KByte (default)

------------------------------------------------------------

[  3] local 107.150.28.246 port 17029 connected with 114.108.219.36 port 61053 (peer 2.0.14-alpha)

[ ID] Interval       Transfer     Bandwidth        Jitter   Lost/Total Datagrams

[  3]  0.0-10.0 sec   979 KBytes   799 Kbits/sec   6.481 ms    2/  684 (0.29%)

[  4] local 107.150.28.246 port 17029 connected with 114.108.219.36 port 61700 (peer 2.0.14-alpha)

[  4]  0.0-30.0 sec  7.50 MBytes  2.09 Mbits/sec   3.060 ms    6/ 5353 (0.11%)

[  3] local 107.150.28.246 port 17029 connected with 114.108.219.36 port 52546 (peer 2.0.14-alpha)

[  3]  0.0-30.0 sec  8.98 MBytes  2.51 Mbits/sec   2.661 ms   16/ 6423 (0.25%)

[  4] local 107.150.28.246 port 17029 connected with 114.108.219.36 port 51827 (peer 2.0.14-alpha)

[  3] local 107.150.28.246 port 17029 connected with 114.108.219.36 port 51825 (peer 2.0.14-alpha)

[  5] local 107.150.28.246 port 17029 connected with 114.108.219.36 port 51826 (peer 2.0.14-alpha)

[  4]  0.0-30.0 sec  2.86 MBytes   799 Kbits/sec   4.828 ms    5/ 2044 (0.24%)

[  5]  0.0-30.0 sec  2.86 MBytes   799 Kbits/sec   5.347 ms    5/ 2044 (0.24%)

[  3]  0.0-30.0 sec  2.86 MBytes   799 Kbits/sec   5.736 ms    4/ 2044 (0.2%)

[SUM]  0.0-30.0 sec  8.58 MBytes  2.40 Mbits/sec   5.736 ms   14/ 6132 (0.23%)

[  6] local 107.150.28.246 port 17029 connected with 114.108.219.36 port 58768 (peer 2.0.14-alpha)

[  5] local 107.150.28.246 port 17029 connected with 114.108.219.36 port 58771 (peer 2.0.14-alpha)

[  4] local 107.150.28.246 port 17029 connected with 114.108.219.36 port 58774 (peer 2.0.14-alpha)

[  3] local 107.150.28.246 port 17029 connected with 114.108.219.36 port 58772 (peer 2.0.14-alpha)

[  7] local 107.150.28.246 port 17029 connected with 114.108.219.36 port 58775 (peer 2.0.14-alpha)

[  8] local 107.150.28.246 port 17029 connected with 114.108.219.36 port 58767 (peer 2.0.14-alpha)

[  9] local 107.150.28.246 port 17029 connected with 114.108.219.36 port 58769 (peer 2.0.14-alpha)

[ 10] local 107.150.28.246 port 17029 connected with 114.108.219.36 port 58773 (peer 2.0.14-alpha)

[ 11] local 107.150.28.246 port 17029 connected with 114.108.219.36 port 58770 (peer 2.0.14-alpha)

[  3]  0.0-30.4 sec  1.25 MBytes   344 Kbits/sec  34.867 ms 1155/ 2044 (57%)

[  7]  0.0-30.4 sec  1.11 MBytes   307 Kbits/sec  25.823 ms 1249/ 2044 (61%)

[  9]  0.0-30.4 sec  1.05 MBytes   289 Kbits/sec  29.907 ms 1296/ 2044 (63%)

[ 11]  0.0-30.4 sec  1.11 MBytes   305 Kbits/sec  33.732 ms 1255/ 2044 (61%)