Ardupilot Rpanion iperf網絡性能測試
- 1. 源由
- 2. 分析
- 3. 安裝
- 4. 測試
- 4.1 第一次測試
- 4.1.1 iperf測試參數A
- 4.1.1.1 測試鏈路1
- 4.1.1.2 測試鏈路2
- 4.1.1.3 測試鏈路3
- 4.1.2 iperf測試參數B - 測試鏈路3
- 4.1.2.1 測試數據
- 4.1.2.2 數據簡單分析
- 4.1.2.3 數據深入分析
- 4.1.2.4 模擬測試網絡
- 4.2 第二次測試
- 4.2.1 測試數據
- 4.2.2 數據分析
- 4.2.3 網絡延遲分析
- 4.2.4 視頻效果
- 4.3 第三次測試
- 4.3.1 測試數據
- 4.3.2 數據分析
- 4.3.3 網絡延遲分析
- 4.3.4 視頻效果
- 5. 總結
- 6. 參考資料
- 7. ZeroTier優化辦法 - Moon節點
- 7.1 服務端配置
- 7.2 客戶端配置
- 8. DJI RC系統性能
1. 源由
網絡性能測試主要目的是:
-
評估網絡健康狀況:網絡性能測試可以幫助評估網絡的健康狀況,包括帶寬、延遲、丟包率等指標。通過了解網絡的實際性能,可以及時發現并解決網絡瓶頸和問題,確保網絡的正常運行。
-
優化網絡性能:通過網絡性能測試,可以確定網絡中存在的瓶頸和性能問題,并采取相應的優化措施。這包括調整網絡設備配置、優化網絡拓撲、升級網絡硬件等,以提高網絡的吞吐量、穩定性和可靠性。
-
規劃網絡擴展和升級:網絡性能測試可以幫助企業規劃網絡的擴展和升級,以滿足不斷增長的業務需求。通過了解當前網絡的性能狀況和未來的需求,可以更好地規劃網絡架構、設備采購和部署策略。
-
保障用戶體驗:良好的網絡性能是保障用戶體驗的關鍵。網絡性能測試可以幫助確保網絡對用戶提供良好的服務質量,包括快速的響應時間、穩定的連接和高質量的數據傳輸。
-
提高網絡安全:網絡性能測試還可以幫助發現和解決網絡安全漏洞和風險。通過測試網絡的性能和安全性,可以識別潛在的安全威脅,并采取相應的防護措施,提高網絡的安全性和可靠性。
最近要做的是針對視頻、電傳鏈路的評估,其在VPN/4G-LTE下性能到底如何?
- 《ArduPilot開源代碼之CompanionComputer上天計劃》
- 《Ardupilot開源代碼之Rover上路計劃》
2. 分析
在進行網絡性能測試時,其主要步驟如下:
-
清晰的測試目標:確定您要測試的網絡性能指標,例如帶寬、延遲、丟包率等。確保您的測試目標清晰明確,并且測試過程中能夠量化和記錄這些指標。
-
選擇適當的測試工具:根據您的測試需求選擇合適的工具。一些常用的網絡性能測試工具包括iperf、Wireshark、PingPlotter等。確保您選擇的工具能夠提供您需要的功能和數據輸出。
-
測試環境的準備:在進行測試之前,確保測試環境的穩定性和一致性。避免在網絡負載較高的時段進行測試,以免影響測試結果。另外,確保測試設備和網絡連接的穩定性,以避免測試過程中出現干擾或故障。
-
數據采集和分析:在測試過程中,及時記錄測試數據,并進行分析和比較。這些數據可以幫助您評估網絡性能,并識別潛在的問題和瓶頸。確保您使用的工具能夠提供詳細的測試結果和分析功能。
-
安全性和合規性:在進行網絡性能測試時,確保您的測試活動不會對網絡安全造成威脅,并遵守相關的法律法規和政策要求。在測試之前,與相關部門或團隊溝通,確保您的測試活動符合組織的安全和合規標準。
-
測試結果的驗證和確認:在完成測試之后,驗證和確認測試結果的準確性和可靠性。如果可能,進行多次測試以確保結果的一致性,并與預期的性能指標進行比較。
綜上所述,網絡性能測試需要仔細的規劃和準備工作,以確保測試結果的準確性和可信度。通過遵循上述注意事項,您可以更好地評估和優化網絡性能,提高網絡的穩定性和效率。
3. 安裝
- Jetson Orin Nano
$ sudo apt-get install iperf
$ iperf --version
iperf version 2.1.5 (3 December 2021) pthreads
- Raspberrry Pi 3B+
$ sudo apt-get install iperf
$ iperf --version
iperf version 2.0.14a (2 October 2020) pthreads
$ iperf --version
iperf version 2.1.5 (3 December 2021) pthreads
daniel@daniel-nvidia:~$ iperf -h
Usage: iperf [-s|-c host] [options]iperf [-h|--help] [-v|--version]Client/Server:-b, --bandwidth #[kmgKMG | pps] bandwidth to read/send at in bits/sec or packets/sec-e, --enhanced use enhanced reporting giving more tcp/udp and traffic information-f, --format [kmgKMG] format to report: Kbits, Mbits, KBytes, MBytes--hide-ips hide ip addresses and host names within outputs-i, --interval # seconds between periodic bandwidth reports-l, --len #[kmKM] length of buffer in bytes to read or write (Defaults: TCP=128K, v4 UDP=1470, v6 UDP=1450)-m, --print_mss print TCP maximum segment size (MTU - TCP/IP header)-o, --output <filename> output the report or error message to this specified file-p, --port # client/server port to listen/send on and to connect--permit-key permit key to be used to verify client and server (TCP only)--sum-only output sum only reports-u, --udp use UDP rather than TCP-w, --window #[KM] TCP window size (socket buffer size)-z, --realtime request realtime scheduler-B, --bind <host>[:<port>][%<dev>] bind to <host>, ip addr (including multicast address) and optional port and device-C, --compatibility for use with older versions does not sent extra msgs-M, --mss # set TCP maximum segment size (MTU - 40 bytes)-N, --nodelay set TCP no delay, disabling Nagle's Algorithm-S, --tos # set the socket's IP_TOS (byte) field-Z, --tcp-congestion <algo> set TCP congestion control algorithm (Linux only)Server specific:-p, --port #[-#] server port(s) to listen on/connect to-s, --server run in server mode-1, --singleclient run one server at a time--histograms enable latency histograms--permit-key-timeout set the timeout for a permit key in seconds--tcp-rx-window-clamp set the TCP receive window clamp size in bytes--tap-dev #[<dev>] use TAP device to receive at L2 layer-t, --time # time in seconds to listen for new connections as well as to receive traffic (default not set)--udp-histogram #,# enable UDP latency histogram(s) with bin width and count, e.g. 1,1000=1(ms),1000(bins)-B, --bind <ip>[%<dev>] bind to multicast address and optional device-U, --single_udp run in single threaded UDP mode--sum-dstip sum traffic threads based upon destination ip address (default is src ip)-D, --daemon run the server as a daemon-V, --ipv6_domain Enable IPv6 reception by setting the domain and socket to AF_INET6 (Can receive on both IPv4 and IPv6)Client specific:-c, --client <host> run in client mode, connecting to <host>--connect-only run a connect only test--connect-retries # number of times to retry tcp connect-d, --dualtest Do a bidirectional test simultaneously (multiple sockets)--fq-rate #[kmgKMG] bandwidth to socket pacing--full-duplex run full duplex test using same socket--ipg set the the interpacket gap (milliseconds) for packets within an isochronous frame--isochronous <frames-per-second>:<mean>,<stddev> send traffic in bursts (frames - emulate video traffic)--incr-dstip Increment the destination ip with parallel (-P) traffic threads--incr-dstport Increment the destination port with parallel (-P) traffic threads--incr-srcip Increment the source ip with parallel (-P) traffic threads--incr-srcport Increment the source port with parallel (-P) traffic threads--local-only Set don't route on socket--near-congestion=[w] Use a weighted write delay per the sampled TCP RTT (experimental)--no-connect-sync No sychronization after connect when -P or parallel traffic threads--no-udp-fin No final server to client stats at end of UDP test-n, --num #[kmgKMG] number of bytes to transmit (instead of -t)-r, --tradeoff Do a fullduplexectional test individually--tcp-write-prefetch set the socket's TCP_NOTSENT_LOWAT value in bytes and use event based writes-t, --time # time in seconds to transmit for (default 10 secs)--trip-times enable end to end measurements (requires client and server clock sync)--txdelay-time time in seconds to hold back after connect and before first write--txstart-time unix epoch time to schedule first write and start traffic-B, --bind [<ip> | <ip:port>] bind ip (and optional port) from which to source traffic-F, --fileinput <name> input the data to be transmitted from a file-H, --ssm-host <ip> set the SSM source, use with -B for (S,G)-I, --stdin input the data to be transmitted from stdin-L, --listenport # port to receive fullduplexectional tests back on-P, --parallel # number of parallel client threads to run-R, --reverse reverse the test (client receives, server sends)-S, --tos IP DSCP or tos settings-T, --ttl # time-to-live, for multicast (default 1)-V, --ipv6_domain Set the domain to IPv6 (send packets over IPv6)-X, --peer-detect perform server version detection and version exchangeMiscellaneous:-x, --reportexclude [CDMSV] exclude C(connection) D(data) M(multicast) S(settings) V(server) reports-y, --reportstyle C report as a Comma-Separated Values-h, --help print this message and quit-v, --version print version information and quit[kmgKMG] Indicates options that support a k,m,g,K,M or G suffix
Lowercase format characters are 10^3 based and uppercase are 2^n based
(e.g. 1k = 1000, 1K = 1024, 1m = 1,000,000 and 1M = 1,048,576)The TCP window size option can be set by the environment variable
TCP_WINDOW_SIZE. Most other options can be set by an environment variable
IPERF_<long option name>, such as IPERF_BANDWIDTH.Source at <http://sourceforge.net/projects/iperf2/>
Report bugs to <iperf-users@lists.sourceforge.net>
4. 測試
- 測試指標:帶寬、延遲、丟包率、穩定性。其他的可靠性、安全性等暫不考慮。
- 測試工具:iperf
4.1 第一次測試
目前,本地已有的測試環境的【網絡拓撲A】,如下所示:
4.1.1 iperf測試參數A
- 服務端:
iperf -u -s
- 客戶端:
iperf -u -T 10 -b [1M] -c [server address]
4.1.1.1 測試鏈路1
- 局域網測試:Pi --> Hub --> Jetson
- 服務端IP地址:192.168.1.19 (Jetson)
- 客戶端IP地址:192.168.1.201 (Pi)
$ iperf -u -T 10 -b 1M -c 192.168.1.19
------------------------------------------------------------
Client connecting to 192.168.1.19, UDP port 5001
UDP buffer size: 208 KByte (default)
------------------------------------------------------------
[ 3] local 192.168.1.201 port 49022 connected with 192.168.1.19 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0000-10.0153 sec 1.25 MBytes 1.05 Mbits/sec
[ 3] Sent 896 datagrams
[ 3] Server Report:
[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
[ 3] 0.0000-10.0116 sec 1.25 MBytes 1.05 Mbits/sec 3.065 ms 0/ 895 (0%)$ iperf -u -T 10 -b 2M -c 192.168.1.19
------------------------------------------------------------
Client connecting to 192.168.1.19, UDP port 5001
UDP buffer size: 208 KByte (default)
------------------------------------------------------------
[ 3] local 192.168.1.201 port 46959 connected with 192.168.1.19 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0000-10.0098 sec 2.50 MBytes 2.10 Mbits/sec
[ 3] Sent 1788 datagrams
[ 3] Server Report:
[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
[ 3] 0.0000-9.9998 sec 2.50 MBytes 2.10 Mbits/sec 2.513 ms 0/ 1787 (0%)$ iperf -u -T 10 -b 3M -c 192.168.1.19
------------------------------------------------------------
Client connecting to 192.168.1.19, UDP port 5001
UDP buffer size: 208 KByte (default)
------------------------------------------------------------
[ 3] local 192.168.1.201 port 44713 connected with 192.168.1.19 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0000-10.0079 sec 3.75 MBytes 3.15 Mbits/sec
[ 3] Sent 2680 datagrams
[ 3] Server Report:
[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
[ 3] 0.0000-10.0206 sec 3.75 MBytes 3.14 Mbits/sec 2.352 ms 1/ 2679 (0.037%)
-
1M帶寬測試:
帶寬:1.05 Mbits/sec
丟包率:0%
Jitter:3.065 ms -
2M帶寬測試:
帶寬:2.10 Mbits/sec
丟包率:0%
Jitter:2.513 ms -
3M帶寬測試:
帶寬:3.14 Mbits/sec
丟包率:0.037%
Jitter:2.352 ms
4.1.1.2 測試鏈路2
- 預設條件:4G LTE SIM卡移除
- VPN測試:Pi --> Hub --> Modem --> Server --> Modem --> Hub --> AP --> Jetson
- 服務端IP地址:172.24.42.46 (Jetson)
- 客戶端IP地址:172.24.161.33 (Pi)
$ iperf -u -T 10 -b 1M -c 172.24.42.46
------------------------------------------------------------
Client connecting to 172.24.42.46, UDP port 5001
UDP buffer size: 208 KByte (default)
------------------------------------------------------------
[ 3] local 172.24.161.33 port 43642 connected with 172.24.42.46 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0000-10.0153 sec 1.25 MBytes 1.05 Mbits/sec
[ 3] Sent 896 datagrams
[ 3] Server Report:
[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
[ 3] 0.0000-9.9983 sec 1.25 MBytes 1.05 Mbits/sec 3.425 ms 0/ 895 (0%)$ iperf -u -T 10 -b 2M -c 172.24.42.46
------------------------------------------------------------
Client connecting to 172.24.42.46, UDP port 5001
UDP buffer size: 208 KByte (default)
------------------------------------------------------------
[ 3] local 172.24.161.33 port 43610 connected with 172.24.42.46 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0000-10.0098 sec 2.50 MBytes 2.10 Mbits/sec
[ 3] Sent 1788 datagrams
[ 3] Server Report:
[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
[ 3] 0.0000-10.0097 sec 2.50 MBytes 2.10 Mbits/sec 3.465 ms 0/ 1787 (0%)$ iperf -u -T 10 -b 3M -c 172.24.42.46
------------------------------------------------------------
Client connecting to 172.24.42.46, UDP port 5001
UDP buffer size: 208 KByte (default)
------------------------------------------------------------
[ 3] local 172.24.161.33 port 37048 connected with 172.24.42.46 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0000-10.0041 sec 3.75 MBytes 3.15 Mbits/sec
[ 3] Sent 2679 datagrams
[ 3] Server Report:
[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
[ 3] 0.0000-10.0336 sec 3.75 MBytes 3.14 Mbits/sec 4.807 ms 0/ 2678 (0%)
-
1M帶寬測試:
帶寬:1.05 Mbits/sec
丟包率:0%
Jitter:3.425 ms -
2M帶寬測試:
帶寬:2.10 Mbits/sec
丟包率:0%
Jitter:3.465 ms -
3M帶寬測試:
帶寬:3.14 Mbits/sec
丟包率:0%
Jitter:4.807 ms
4.1.1.3 測試鏈路3
- 預設條件:有線IP網絡物理斷開
- VPN測試:Pi --> 4G LTE --> BTS --> Server --> Modem --> Hub --> AP --> Jetson
- 服務端IP地址:172.24.42.46 (Jetson)
- 客戶端IP地址:172.24.161.33 (Pi)
$ iperf -u -T 10 -b 1M -c 172.24.42.46
------------------------------------------------------------
Client connecting to 172.24.42.46, UDP port 5001
UDP buffer size: 208 KByte (default)
------------------------------------------------------------
[ 3] local 172.24.161.33 port 34869 connected with 172.24.42.46 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0000-10.0154 sec 1.25 MBytes 1.05 Mbits/sec
[ 3] Sent 896 datagrams
[ 3] Server Report:
[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
[ 3] 0.0000-9.9907 sec 1.25 MBytes 1.05 Mbits/sec 8.210 ms 0/ 895 (0%)$ iperf -u -T 10 -b 2M -c 172.24.42.46
------------------------------------------------------------
Client connecting to 172.24.42.46, UDP port 5001
UDP buffer size: 208 KByte (default)
------------------------------------------------------------
[ 3] local 172.24.161.33 port 35665 connected with 172.24.42.46 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0000-10.0098 sec 2.50 MBytes 2.10 Mbits/sec
[ 3] Sent 1788 datagrams
[ 3] Server Report:
[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
[ 3] 0.0000-9.9933 sec 2.50 MBytes 2.10 Mbits/sec 7.350 ms 0/ 1787 (0%)$ iperf -u -T 10 -b 3M -c 172.24.42.46
------------------------------------------------------------
Client connecting to 172.24.42.46, UDP port 5001
UDP buffer size: 208 KByte (default)
------------------------------------------------------------
[ 3] local 172.24.161.33 port 43883 connected with 172.24.42.46 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0000-10.0079 sec 3.75 MBytes 3.15 Mbits/sec
[ 3] Sent 2680 datagrams
[ 3] Server Report:
[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
[ 3] 0.0000-10.0150 sec 3.75 MBytes 3.14 Mbits/sec 5.268 ms 0/ 2679 (0%)
-
1M帶寬測試:
帶寬:1.05 Mbits/sec
丟包率:0%
Jitter:8.210 ms -
2M帶寬測試:
帶寬:2.10 Mbits/sec
丟包率:0%
Jitter:7.350 ms -
3M帶寬測試:
帶寬:3.14 Mbits/sec
丟包率:0%
Jitter:5.268 ms
4.1.2 iperf測試參數B - 測試鏈路3
為什么要引入測試參數B?主要原因是:
- 4G LTE視頻發現花屏+卡頓現象
- 測試參數A給出的1/2/3鏈路狀況都是非常理想的
上述兩個現象與實際結果發生了嚴重的不一致問題,太困惑了。
- 4G LTE networks results in significant screen freezing and stuttering #225
懷疑:是否是iperf測試參數問題導致測試結果不準確。因此,調整測試參數如下:
- 服務端:
iperf -u -s
- 客戶端:
iperf -u -T 10 -b [1M] -l 20 -e -i 1 -t 60 -c [server address]
預設條件:有線IP網絡物理斷開
VPN測試:Pi --> 4G LTE --> BTS --> Server --> Modem --> Hub --> AP --> Jetson
服務端IP地址:172.24.42.46 (Jetson)
客戶端IP地址:172.24.161.33 (Pi)
4.1.2.1 測試數據
$ iperf -u -T 10 -b 2M -l 20 -e -i 1 -t 60 -c 172.24.42.46
------------------------------------------------------------
Client connecting to 172.24.42.46, UDP port 5001 with pid 950 (1 flows)
Write buffer size: 20.0 Byte
UDP buffer size: 208 KByte (default)
------------------------------------------------------------
[ 3] local 172.24.161.33%zt44xhvvrc port 57316 connected with 172.24.42.46 port 5001
[ ID] Interval Transfer Bandwidth Write/Err PPS
[ 3] 0.0000-1.0000 sec 256 KBytes 2.10 Mbits/sec 13104/0 13105 pps
[ 3] 1.0000-2.0000 sec 256 KBytes 2.10 Mbits/sec 13111/0 13112 pps
[ 3] 2.0000-3.0000 sec 256 KBytes 2.10 Mbits/sec 13108/0 13106 pps
[ 3] 3.0000-4.0000 sec 256 KBytes 2.10 Mbits/sec 13106/0 13108 pps
[ 3] 4.0000-5.0000 sec 256 KBytes 2.10 Mbits/sec 13107/0 13108 pps
[ 3] 5.0000-6.0000 sec 256 KBytes 2.10 Mbits/sec 13107/0 13105 pps
[ 3] 6.0000-7.0000 sec 256 KBytes 2.10 Mbits/sec 13107/0 13107 pps
[ 3] 7.0000-8.0000 sec 256 KBytes 2.10 Mbits/sec 13109/0 13108 pps
[ 3] 8.0000-9.0000 sec 256 KBytes 2.10 Mbits/sec 13103/0 13103 pps
[ 3] 9.0000-10.0000 sec 256 KBytes 2.10 Mbits/sec 13108/0 13112 pps
[ 3] 10.0000-11.0000 sec 256 KBytes 2.10 Mbits/sec 13111/0 13106 pps
[ 3] 11.0000-12.0000 sec 256 KBytes 2.10 Mbits/sec 13106/0 13108 pps
[ 3] 12.0000-13.0000 sec 256 KBytes 2.10 Mbits/sec 13108/0 13107 pps
[ 3] 13.0000-14.0000 sec 256 KBytes 2.10 Mbits/sec 13105/0 13107 pps
[ 3] 14.0000-15.0000 sec 256 KBytes 2.10 Mbits/sec 13105/0 13102 pps
[ 3] 15.0000-16.0000 sec 256 KBytes 2.10 Mbits/sec 13112/0 13113 pps
[ 3] 16.0000-17.0000 sec 256 KBytes 2.10 Mbits/sec 13104/0 13104 pps
[ 3] 17.0000-18.0000 sec 256 KBytes 2.10 Mbits/sec 13109/0 13111 pps
[ 3] 18.0000-19.0000 sec 256 KBytes 2.10 Mbits/sec 13109/0 13107 pps
[ 3] 19.0000-20.0000 sec 256 KBytes 2.10 Mbits/sec 13105/0 13107 pps
[ 3] 20.0000-21.0000 sec 256 KBytes 2.10 Mbits/sec 13108/0 13105 pps
[ 3] 21.0000-22.0000 sec 256 KBytes 2.10 Mbits/sec 13105/0 13109 pps
[ 3] 22.0000-23.0000 sec 256 KBytes 2.10 Mbits/sec 13097/0 13107 pps
[ 3] 23.0000-24.0000 sec 256 KBytes 2.10 Mbits/sec 13120/0 13107 pps
[ 3] 24.0000-25.0000 sec 256 KBytes 2.10 Mbits/sec 13106/0 13105 pps
[ 3] 25.0000-26.0000 sec 256 KBytes 2.10 Mbits/sec 13107/0 13110 pps
[ 3] 26.0000-27.0000 sec 256 KBytes 2.10 Mbits/sec 13107/0 13105 pps
[ 3] 27.0000-28.0000 sec 256 KBytes 2.10 Mbits/sec 13107/0 13109 pps
[ 3] 28.0000-29.0000 sec 256 KBytes 2.10 Mbits/sec 13108/0 13105 pps
[ 3] 29.0000-30.0000 sec 256 KBytes 2.10 Mbits/sec 13107/0 13107 pps
[ 3] 30.0000-31.0000 sec 256 KBytes 2.10 Mbits/sec 13106/0 13106 pps
[ 3] 31.0000-32.0000 sec 256 KBytes 2.10 Mbits/sec 13109/0 13110 pps
[ 3] 32.0000-33.0000 sec 256 KBytes 2.10 Mbits/sec 13108/0 13108 pps
[ 3] 33.0000-34.0000 sec 256 KBytes 2.10 Mbits/sec 13104/0 13107 pps
[ 3] 34.0000-35.0000 sec 256 KBytes 2.10 Mbits/sec 13109/0 13105 pps
[ 3] 35.0000-36.0000 sec 256 KBytes 2.10 Mbits/sec 13109/0 13109 pps
[ 3] 36.0000-37.0000 sec 256 KBytes 2.10 Mbits/sec 13106/0 13108 pps
[ 3] 37.0000-38.0000 sec 256 KBytes 2.10 Mbits/sec 13107/0 13105 pps
[ 3] 38.0000-39.0000 sec 256 KBytes 2.10 Mbits/sec 13108/0 13109 pps
[ 3] 39.0000-40.0000 sec 256 KBytes 2.10 Mbits/sec 13106/0 13107 pps
[ 3] 40.0000-41.0000 sec 256 KBytes 2.10 Mbits/sec 13107/0 13107 pps
[ 3] 41.0000-42.0000 sec 256 KBytes 2.10 Mbits/sec 13109/0 13107 pps
[ 3] 42.0000-43.0000 sec 256 KBytes 2.10 Mbits/sec 13105/0 13107 pps
[ 3] 43.0000-44.0000 sec 256 KBytes 2.10 Mbits/sec 13108/0 13107 pps
[ 3] 44.0000-45.0000 sec 256 KBytes 2.10 Mbits/sec 13107/0 13107 pps
[ 3] 45.0000-46.0000 sec 256 KBytes 2.10 Mbits/sec 13107/0 13104 pps
[ 3] 46.0000-47.0000 sec 256 KBytes 2.10 Mbits/sec 13109/0 13109 pps
[ 3] 47.0000-48.0000 sec 256 KBytes 2.10 Mbits/sec 13107/0 13108 pps
[ 3] 48.0000-49.0000 sec 256 KBytes 2.10 Mbits/sec 13107/0 13106 pps
[ 3] 49.0000-50.0000 sec 256 KBytes 2.10 Mbits/sec 13105/0 13105 pps
[ 3] 50.0000-51.0000 sec 256 KBytes 2.10 Mbits/sec 13110/0 13110 pps
[ 3] 51.0000-52.0000 sec 256 KBytes 2.10 Mbits/sec 13104/0 13108 pps
[ 3] 52.0000-53.0000 sec 256 KBytes 2.10 Mbits/sec 13110/0 13106 pps
[ 3] 53.0000-54.0000 sec 256 KBytes 2.10 Mbits/sec 13108/0 13108 pps
[ 3] 54.0000-55.0000 sec 256 KBytes 2.10 Mbits/sec 13105/0 13108 pps
[ 3] 55.0000-56.0000 sec 256 KBytes 2.10 Mbits/sec 13108/0 13107 pps
[ 3] 56.0000-57.0000 sec 256 KBytes 2.10 Mbits/sec 13108/0 13107 pps
[ 3] 57.0000-58.0000 sec 256 KBytes 2.10 Mbits/sec 13107/0 13106 pps
[ 3] 58.0000-59.0000 sec 256 KBytes 2.10 Mbits/sec 13106/0 13106 pps
[ 3] 59.0000-60.0000 sec 256 KBytes 2.10 Mbits/sec 13107/0 13108 pps
[ 3] 0.0000-60.0007 sec 15.0 MBytes 2.10 Mbits/sec 786443/0 13107 pps
[ 3] Sent 786443 datagrams
[ 3] Server Report:
[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
[ 3] 0.0000-60.1233 sec 7.88 MBytes 1.10 Mbits/sec 0.145 ms 373400/786443 (47%)
[ 3] 0.0000-60.1233 sec 32 datagrams received out-of-order
4.1.2.2 數據簡單分析
- 測試設置為使用UDP協議,目標帶寬為2Mbps,發送數據包大小為20字節,持續時間為60秒。
- 客戶端連接到IP地址為172.24.42.46的服務器。
- 在整個測試期間,每秒發送的數據包數量保持在大約13100個左右,除非有數據包丟失,否則保持穩定。
- 服務器報告顯示,在60秒的測試期間,共發送了786443個數據包,其中約47%的數據包丟失,且有32個數據包接收時順序錯亂。
- 帶寬的實際測量結果約為1.10 Mbits/sec,明顯低于設定的2Mbps目標帶寬。
綜上所述,這些數據表明在給定的網絡環境下存在丟包和順序錯亂的問題,導致帶寬表現不佳。可能的原因包括網絡擁塞、傳輸延遲、或網絡設備配置問題。為解決這些問題,可以考慮優化網絡配置、增加帶寬、或改善網絡連接質量。
4.1.2.3 數據深入分析
本次測試已經發現一些線索,至少確實可能存在鏈路狀況不佳的情況。
分析對比測試線A v/s B的差異:
- 測試參數A:默認v4 UDP=1470, v6 UDP=1450
- 測試參數B:數據包大小20字節,每秒報文數量13105
在維持帶寬情況下,小包數量增加,會引起網絡擁塞,進而導致丟包率明顯增加。此時,出現花屏和卡頓就不足為奇。
從這里可以認識到,之前的測試過于簡單。
因為視頻流并非只是發送一種長度的報文,可能是變化的;另外,在編碼完成后,會有發送報文需求;在圖像編碼時,視頻數據尚沒有準備好,此時,并無數據發送需求,網絡帶寬是空閑的。
引入以下思考:視頻傳輸H264編碼P/I幀的數據發送是如何分布的(時空概念)?
- 報文大小分布情況如何?
- 報文發送速率如何?
- Bit Rate Throttling Algorithm on Video over RTP
舉了一個例子:
- 高峰時刻I幀,5ms 15個數據包,而I幀又是完整的幀圖像,如果此時出現丟包,那可不就是花屏、卡頓。
- 每間隔2秒,傳輸報文數量出現一個2倍峰值
- 15FPS(66.7ms)下,H264每隔62ms出現一個峰值大包傳輸集中點(時刻)
4.1.2.4 模擬測試網絡
模擬高峰時刻帶寬測試:5ms 15包數據(每秒15x1000/5=3000pps),1400字節一包。
- 實際測試網絡,還存在其他視頻鏈路,應用程序等等網絡開銷
- 模擬始終高壓傳輸,導致帶寬更加緊張,容易導致UDP丟包
最終結果:81%丟包率,壓根沒法看視頻了(妥妥的2-8定律)
$ iperf -b 3000pps -u -e -i 1 -l 1400 -c 172.24.42.46
------------------------------------------------------------
Client connecting to 172.24.42.46, UDP port 5001 with pid 1137 (1 flows)
Write buffer size: 1.37 KByte
UDP buffer size: 208 KByte (default)
------------------------------------------------------------
[ 3] local 172.24.161.33%zt44xhvvrc port 49273 connected with 172.24.42.46 port 5001
[ ID] Interval Transfer Bandwidth Write/Err PPS
[ 3] 0.0000-1.0000 sec 4.01 MBytes 33.6 Mbits/sec 3001/0 3002 pps
[ 3] 1.0000-2.0000 sec 4.01 MBytes 33.6 Mbits/sec 3001/0 3000 pps
[ 3] 2.0000-3.0000 sec 4.00 MBytes 33.6 Mbits/sec 2996/0 3000 pps
[ 3] 3.0000-4.0000 sec 4.01 MBytes 33.6 Mbits/sec 3003/0 2999 pps
[ 3] 4.0000-5.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3001 pps
[ 3] 5.0000-6.0000 sec 4.01 MBytes 33.6 Mbits/sec 3001/0 3000 pps
[ 3] 6.0000-7.0000 sec 4.00 MBytes 33.6 Mbits/sec 2999/0 3000 pps
[ 3] 7.0000-8.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 8.0000-9.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 9.0000-10.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 0.0000-10.0009 sec 40.1 MBytes 33.6 Mbits/sec 30005/0 3000 pps
[ 3] Sent 30005 datagrams
[ 3] Server Report:
[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
[ 3] 0.0000-10.3893 sec 7.64 MBytes 6.17 Mbits/sec 2.070 ms 24283/30007 (81%)
4.2 第二次測試
鑒于第一次測試的網絡拓撲問題,現在只用一個4G LTE鏈路:因此鏈路獨享,功能單一,不會有太多的競爭關系。【網絡拓撲B】調整如下:
4.2.1 測試數據
$ iperf -b 3000pps -u -e -i 1 -l 1400 -c 172.24.42.46
------------------------------------------------------------
Client connecting to 172.24.42.46, UDP port 5001 with pid 1426 (1 flows)
Write buffer size: 1.37 KByte
UDP buffer size: 208 KByte (default)
------------------------------------------------------------
[ 3] local 172.24.161.33%zt44xhvvrc port 51044 connected with 172.24.42.46 port 5001
[ ID] Interval Transfer Bandwidth Write/Err PPS
[ 3] 0.0000-1.0000 sec 4.01 MBytes 33.6 Mbits/sec 3001/0 3002 pps
[ 3] 1.0000-2.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 2.0000-3.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 3.0000-4.0000 sec 4.01 MBytes 33.6 Mbits/sec 3001/0 3001 pps
[ 3] 4.0000-5.0000 sec 4.00 MBytes 33.6 Mbits/sec 2999/0 2999 pps
[ 3] 5.0000-6.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 6.0000-7.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 7.0000-8.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 8.0000-9.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 9.0000-10.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 0.0000-10.0009 sec 40.1 MBytes 33.6 Mbits/sec 30005/0 3000 pps
[ 3] Sent 30005 datagrams
[ 3] Server Report:
[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
[ 3] 0.0000-10.2656 sec 37.5 MBytes 30.7 Mbits/sec 0.268 ms 1890/30004 (6.3%)
注:更多測試數據供參考。
daniel@rpanion:~ $ iperf -b 3000pps -u -e -i 1 -l 1400 -c 172.24.42.46
------------------------------------------------------------
Client connecting to 172.24.42.46, UDP port 5001 with pid 1510 (1 flows)
Write buffer size: 1.37 KByte
UDP buffer size: 208 KByte (default)
------------------------------------------------------------
[ 3] local 172.24.161.33%zt44xhvvrc port 43161 connected with 172.24.42.46 port 5001
[ ID] Interval Transfer Bandwidth Write/Err PPS
[ 3] 0.0000-1.0000 sec 4.01 MBytes 33.6 Mbits/sec 3001/0 3002 pps
[ 3] 1.0000-2.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 2.0000-3.0000 sec 4.01 MBytes 33.6 Mbits/sec 3001/0 3001 pps
[ 3] 3.0000-4.0000 sec 4.00 MBytes 33.6 Mbits/sec 2999/0 2999 pps
[ 3] 4.0000-5.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 5.0000-6.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 6.0000-7.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 7.0000-8.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 8.0000-9.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 9.0000-10.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 0.0000-10.0009 sec 40.1 MBytes 33.6 Mbits/sec 30005/0 3000 pps
[ 3] Sent 30005 datagrams
[ 3] Server Report:
[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
[ 3] 0.0000-10.0739 sec 39.7 MBytes 33.0 Mbits/sec 0.191 ms 278/30004 (0.93%)
daniel@rpanion:~ $ iperf -b 3000pps -u -e -i 1 -l 1400 -c 172.24.42.46
------------------------------------------------------------
Client connecting to 172.24.42.46, UDP port 5001 with pid 1516 (1 flows)
Write buffer size: 1.37 KByte
UDP buffer size: 208 KByte (default)
------------------------------------------------------------
[ 3] local 172.24.161.33%zt44xhvvrc port 59910 connected with 172.24.42.46 port 5001
[ ID] Interval Transfer Bandwidth Write/Err PPS
[ 3] 0.0000-1.0000 sec 4.01 MBytes 33.6 Mbits/sec 3001/0 3002 pps
[ 3] 1.0000-2.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 2.0000-3.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 3.0000-4.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 4.0000-5.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 5.0000-6.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 6.0000-7.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 7.0000-8.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 8.0000-9.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 9.0000-10.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 0.0000-10.0008 sec 40.1 MBytes 33.6 Mbits/sec 30005/0 3000 pps
[ 3] Sent 30005 datagrams
[ 3] Server Report:
[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
[ 3] 0.0000-10.2943 sec 36.7 MBytes 29.9 Mbits/sec 0.462 ms 2551/30004 (8.5%)
daniel@rpanion:~ $ iperf -b 3000pps -u -e -i 1 -l 1400 -c 172.24.42.46
------------------------------------------------------------
Client connecting to 172.24.42.46, UDP port 5001 with pid 1520 (1 flows)
Write buffer size: 1.37 KByte
UDP buffer size: 208 KByte (default)
------------------------------------------------------------
[ 3] local 172.24.161.33%zt44xhvvrc port 40583 connected with 172.24.42.46 port 5001
[ ID] Interval Transfer Bandwidth Write/Err PPS
[ 3] 0.0000-1.0000 sec 4.01 MBytes 33.6 Mbits/sec 3001/0 3001 pps
[ 3] 1.0000-2.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 2.0000-3.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 3.0000-4.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 4.0000-5.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 5.0000-6.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 6.0000-7.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 7.0000-8.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 8.0000-9.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 9.0000-10.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 0.0000-10.0022 sec 40.1 MBytes 33.6 Mbits/sec 30009/0 3000 pps
[ 3] Sent 30009 datagrams
[ 3] Server Report:
[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
[ 3] 0.0000-10.0383 sec 38.3 MBytes 32.0 Mbits/sec 0.262 ms 1311/30008 (4.4%)
daniel@rpanion:~ $ iperf -b 3000pps -u -e -i 1 -l 1400 -c 172.24.42.46
------------------------------------------------------------
Client connecting to 172.24.42.46, UDP port 5001 with pid 1524 (1 flows)
Write buffer size: 1.37 KByte
UDP buffer size: 208 KByte (default)
------------------------------------------------------------
[ 3] local 172.24.161.33%zt44xhvvrc port 47580 connected with 172.24.42.46 port 5001
[ ID] Interval Transfer Bandwidth Write/Err PPS
[ 3] 0.0000-1.0000 sec 3.96 MBytes 33.2 Mbits/sec 2967/0 3002 pps
[ 3] 1.0000-2.0000 sec 4.00 MBytes 33.6 Mbits/sec 2997/0 3000 pps
[ 3] 2.0000-3.0000 sec 4.03 MBytes 33.8 Mbits/sec 3015/0 2979 pps
[ 3] 3.0000-4.0000 sec 4.03 MBytes 33.8 Mbits/sec 3016/0 3014 pps
[ 3] 4.0000-5.0000 sec 3.98 MBytes 33.4 Mbits/sec 2982/0 3007 pps
[ 3] 5.0000-6.0000 sec 4.04 MBytes 33.9 Mbits/sec 3024/0 3000 pps
[ 3] 6.0000-7.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 7.0000-8.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 8.0000-9.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 9.0000-10.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 0.0000-10.0009 sec 40.1 MBytes 33.6 Mbits/sec 30005/0 3000 pps
[ 3] Sent 30005 datagrams
[ 3] Server Report:
[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
[ 3] 0.0000-10.0151 sec 39.7 MBytes 33.3 Mbits/sec 0.302 ms 235/30004 (0.78%)
daniel@rpanion:~ $ iperf -b 3000pps -u -e -i 1 -l 1400 -c 172.24.42.46
------------------------------------------------------------
Client connecting to 172.24.42.46, UDP port 5001 with pid 1527 (1 flows)
Write buffer size: 1.37 KByte
UDP buffer size: 208 KByte (default)
------------------------------------------------------------
[ 3] local 172.24.161.33%zt44xhvvrc port 44434 connected with 172.24.42.46 port 5001
[ ID] Interval Transfer Bandwidth Write/Err PPS
[ 3] 0.0000-1.0000 sec 4.01 MBytes 33.6 Mbits/sec 3001/0 3001 pps
[ 3] 1.0000-2.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 2.0000-3.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 3.0000-4.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 4.0000-5.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 5.0000-6.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 6.0000-7.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 7.0000-8.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 8.0000-9.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 9.0000-10.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 0.0000-10.0009 sec 40.1 MBytes 33.6 Mbits/sec 30005/0 3000 pps
[ 3] Sent 30005 datagrams
[ 3] Server Report:
[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
[ 3] 0.0000-10.0227 sec 40.1 MBytes 33.5 Mbits/sec 0.474 ms 0/30004 (0%)
4.2.2 數據分析
根據提供的iperf數據,我們可以得到以下分析:
-
帶寬:
平均帶寬為33.6 Mbits/sec,這是UDP流量在網絡上的平均傳輸速率。 -
丟包率:
總共發送了30005個數據包,其中有1890個數據包丟失。
丟包率為6.3%。這意味著有6.3%的數據包未能成功到達目的地。這可能是由于網絡擁塞、丟包或其他網絡問題引起的。 -
Jitter:
Jitter指的是數據包傳輸之間的時延變化。在本例中,Jitter為0.268毫秒。Jitter越小,表示數據包傳輸的穩定性越高。 -
PPS(每秒數據包數):
平均每秒傳輸了3000個數據包。這是一個可用于評估網絡負載的指標。
綜合來看,雖然仍存在6.3%的丟包率,實際情況不可能長時間高壓力,視頻碼流也有FEC等糾錯機制。相對于第一次測試情況,相對來說該網絡鏈路環境更為理想,也更加符合實際使用情況。
4.2.3 網絡延遲分析
通過ping命令,iperf(Linux端)和QGC(Windows端),分析網絡延時:
- iperf(Linux端):平均3.35ms
64 bytes from 172.24.161.33: icmp_seq=1 ttl=64 time=3.07 ms
64 bytes from 172.24.161.33: icmp_seq=2 ttl=64 time=3.14 ms
64 bytes from 172.24.161.33: icmp_seq=3 ttl=64 time=3.83 ms
64 bytes from 172.24.161.33: icmp_seq=4 ttl=64 time=3.35 ms
- QGC(Windows端):平均7.75ms
Reply from 172.24.161.33: bytes=32 time=7ms TTL=64
Reply from 172.24.161.33: bytes=32 time=3ms TTL=64
Reply from 172.24.161.33: bytes=32 time=12ms TTL=64
Reply from 172.24.161.33: bytes=32 time=9ms TTL=64
4.2.4 視頻效果
實測效果: ~ 245 ms 時延;???貌似VPN沒啥時延啊?呵呵,后面說,賣個關子。
Rpanion OV5647 ZeroTier 網絡拓撲B 性能實測
4.3 第三次測試
使用更加貼近實際場景,兩個4G LTE獨享帶寬【網絡拓撲C】。
4.3.1 測試數據
$ iperf -b 3000pps -u -e -i 1 -l 1400 -c 172.24.42.46
------------------------------------------------------------
Client connecting to 172.24.42.46, UDP port 5001 with pid 860 (1 flows)
Write buffer size: 1.37 KByte
UDP buffer size: 208 KByte (default)
------------------------------------------------------------
[ 3] local 172.24.161.33%zt44xhvvrc port 36516 connected with 172.24.42.46 port 5001
[ ID] Interval Transfer Bandwidth Write/Err PPS
[ 3] 0.0000-1.0000 sec 4.01 MBytes 33.6 Mbits/sec 3002/0 3002 pps
[ 3] 1.0000-2.0000 sec 4.00 MBytes 33.6 Mbits/sec 2999/0 3000 pps
[ 3] 2.0000-3.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 3.0000-4.0000 sec 4.00 MBytes 33.6 Mbits/sec 2999/0 3000 pps
[ 3] 4.0000-5.0000 sec 4.01 MBytes 33.6 Mbits/sec 3001/0 3000 pps
[ 3] 5.0000-6.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 6.0000-7.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 2999 pps
[ 3] 7.0000-8.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3001 pps
[ 3] 8.0000-9.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 9.0000-10.0000 sec 4.01 MBytes 33.6 Mbits/sec 3001/0 3001 pps
[ 3] 0.0000-10.0015 sec 40.1 MBytes 33.6 Mbits/sec 30007/0 3000 pps
[ 3] Sent 30007 datagrams
[ 3] Server Report:
[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
[ 3] 0.0000-10.3614 sec 37.5 MBytes 30.4 Mbits/sec 0.469 ms 1882/30006 (6.3%)
[ 3] 0.0000-10.3614 sec 2921 datagrams received out-of-order
注:更多測試數據供參考。
$ iperf -b 3000pps -u -e -i 1 -l 1400 -c 172.24.42.46
------------------------------------------------------------
Client connecting to 172.24.42.46, UDP port 5001 with pid 1484 (1 flows)
Write buffer size: 1.37 KByte
UDP buffer size: 208 KByte (default)
------------------------------------------------------------
[ 3] local 172.24.161.33%zt44xhvvrc port 39651 connected with 172.24.42.46 port 5001
[ ID] Interval Transfer Bandwidth Write/Err PPS
[ 3] 0.0000-1.0000 sec 4.01 MBytes 33.6 Mbits/sec 3001/0 3002 pps
[ 3] 1.0000-2.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 2.0000-3.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 3.0000-4.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 4.0000-5.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 5.0000-6.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 6.0000-7.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 7.0000-8.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 8.0000-9.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 9.0000-10.0000 sec 4.01 MBytes 33.6 Mbits/sec 3000/0 3000 pps
[ 3] 0.0000-10.0005 sec 40.1 MBytes 33.6 Mbits/sec 30004/0 3000 pps
[ 3] Sent 30004 datagrams
[ 3] Server Report:
[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
[ 3] 0.0000-10.1356 sec 36.8 MBytes 30.4 Mbits/sec 0.174 ms 2446/30003 (8.2%)
4.3.2 數據分析
-
測試參數:
使用了以下參數進行測試:帶寬設置為3000pps、使用UDP協議、啟用錯誤報告、設置報告間隔為1秒、每個數據包大小為1400字節,連接到IP地址為172.24.42.46的服務器。 -
客戶端信息:
客戶端IP地址為172.24.161.33,端口36516,連接到服務器IP地址為172.24.42.46,端口5001。 -
傳輸數據:
在每個1秒的時間間隔內,傳輸了大約4.01兆字節的數據。
帶寬在每秒都維持在約33.6兆位/秒。
平均每秒發送的數據包數(PPS)為3000左右。 -
UDP錯誤:
未發現UDP錯誤。 -
服務器報告:
在10.36秒的測試期間,總共傳輸了37.5兆字節的數據。
平均帶寬為30.4兆位/秒。
報告的抖動(jitter)為0.469毫秒。
6.3%的數據包丟失率,共丟失1882個數據包。
有2921個數據包收到時是亂序的。
綜上所述,該iperf測試表明UDP連接在設定的條件下運行良好,但存在一定程度的數據包丟失和亂序。
4.3.3 網絡延遲分析
通過ping命令,iperf(Linux端)和QGC(Windows端),分析網絡延時:
- iperf(Linux端):平均607.5ms
64 bytes from 172.24.161.33: icmp_seq=1 ttl=64 time=668 ms
64 bytes from 172.24.161.33: icmp_seq=2 ttl=64 time=583 ms
64 bytes from 172.24.161.33: icmp_seq=4 ttl=64 time=565 ms
64 bytes from 172.24.161.33: icmp_seq=5 ttl=64 time=614 ms
- QGC(Windows端):平均822.25ms
Reply from 172.24.161.33: bytes=32 time=825ms TTL=64
Reply from 172.24.161.33: bytes=32 time=854ms TTL=64
Reply from 172.24.161.33: bytes=32 time=801ms TTL=64
Reply from 172.24.161.33: bytes=32 time=809ms TTL=64
4.3.4 視頻效果
實測效果: ~ 569 ms 時延; Linux端607.5/2 = 303ms, 569 - 303 = 266 ms左右。
Rpanion OV5647 ZeroTier 網絡拓撲C 性能實測
5. 總結
綜上所述:
- 【網絡拓撲A】~ 200 ms, 參考:《ArduPilot開源飛控之lida2003套機+伴機電腦首飛》
- 【網絡拓撲B】~ 245 ms
- 【網絡拓撲C】~ 569 ms
- 局域網點對點性能最好,直接就是Rpanion+Rpi3B+ 200ms時延。
- 統一WLAN出口,VPN仍然能夠很好的優化,與局域網性能相當。
- 實際不同發射/接受鏈路網絡,若VPN不做好優化,時延會很顯著。
實際使用場景,需要看鏈路情況,若要進行商業部署,必須做好優化,或者自建網絡(VPN/P2P等等)來控制好鏈路時延問題。
Ardupilot + Rpi3B+ + OV5647 + 4G LTE Copter
6. 參考資料
【1】zerotier - Securely connect any device, anywhere.
7. ZeroTier優化辦法 - Moon節點
7.1 服務端配置
- Step1:安裝zerotier-one
# curl -s https://install.zerotier.com/ | sudo bash
- Step2:加入自己的網絡
# zerotier-cli join <Network ID>
- Step3:生成moon.json文件
# cd /var/lib/zerotier-one
# zerotier-idtool initmoon identity.public > moon.json
- Step4:修改moon.json文件 //服務器,打開安全組,開放9993端口,采用UDP協議
# vi moon.json //字段中修改:“stableEndpoints”: [“服務器的ip/9993”]
- Step5:生成簽名文件 //生成一個
000000xxxxxxxxx.moon
的文件
# zerotier-idtool genmoon moon.json
- Step6:新建自己的moon節點配置
# mkdir moons.d
# mv 000000xxxxxxxxx.moon moons.d
# service zerotier-one restart //之后重啟服務器端B的Zerotier
7.2 客戶端配置
- Step1:下載配置文件
# scp usrname@ServerIP:/var/lib/zerotier-one/moons.d/000000xxxxxxxxx.moon .
- Step2:前往zerotier安裝目錄 //window一般在
C:\ProgramData\ZeroTier\One
- Step3:新建
ZeroTier\One\moons.d
目錄,并復制00000xxxx.moon
- Step4:重啟windows服務
- Step5:查看moon服務器 //確認服務器(IP)和節點已經在列表中,表示成功
# zerotier-cli listpeers
- Step6:查看
ping
延遲 //網絡跳轉越少,路線越短,性能越好。國內典型值在20ms左右。
8. DJI RC系統性能
DJI RC Pro features O3+ video transmission technology, capable of sending a 1080p/60fps live feed from up to 15 km away and latency as low as 120 ms.