Linux-Networking
iperf,linux調度報告的可變數量的失去UDP數據包?
我正在測試與在 Bananpi M2+ 單板電腦(Debian,5.1.1-BPI-Kernel #1 SM)上執行的 iperf 伺服器(iperf 版本 2.0.13(2019 年 1 月 21 日)pthreads)的連接。對於不同的目標頻寬,我觀察到不同的丟包率。對於非常低和非常高的目標頻寬設置(低於 1%),丟棄的數據包數量很少。然而,對於中等值,失去的數據包數量非常高(例如,29% 的數據包在 400 Mbps 時失去)。什麼可能導致這種行為?(詳細結果見下文)。這是在測試網路中發生的唯一通信(因此必須在目標端發生丟棄)。
我已經嘗試調整 UDP 套接字的大小,但這並沒有改善結果。
------------------------------------------------------------ Server listening on UDP port 5001 Receiving 1470 byte datagrams UDP buffer size: 3.81 MByte (WARNING: requested 1.91 MByte) ------------------------------------------------------------ [ 3] local 192.168.1.11 port 5001 connected with 192.168.1.201 port 37950 [ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams [ 3] 0.0-10.0 sec 11.9 MBytes 10.0 Mbits/sec 0.195 ms 0/ 8504 (0%) [ 4] local 192.168.1.11 port 5001 connected with 192.168.1.201 port 32833 [ 4] 0.0-10.0 sec 118 MBytes 98.9 Mbits/sec 0.306 ms 571/85034 (0.67%) [ 3] local 192.168.1.11 port 5001 connected with 192.168.1.201 port 56833 [ 3] 0.0-10.0 sec 344 MBytes 288 Mbits/sec 0.053 ms 9951/255103 (3.9%) [ 4] local 192.168.1.11 port 5001 connected with 192.168.1.201 port 51751 [ 4] 0.0-10.0 sec 337 MBytes 283 Mbits/sec 0.026 ms 99684/340136 (29%) [ 3] local 192.168.1.11 port 5001 connected with 192.168.1.201 port 53331 [ 3] 0.0-10.0 sec 512 MBytes 429 Mbits/sec 0.018 ms 60157/425171 (14%) [ 4] local 192.168.1.11 port 5001 connected with 192.168.1.201 port 35110 [ 4] 0.0-10.0 sec 832 MBytes 698 Mbits/sec 0.014 ms 1860/595239 (0.31%) [ 3] local 192.168.1.11 port 5001 connected with 192.168.1.201 port 52002 [ 3] 0.0-10.0 sec 1.04 GBytes 897 Mbits/sec 0.013 ms 2895/765308 (0.38%)
當我將 iperf 作為具有預設優先級的程序執行時,更新為 400 Mbps,我得到以下結果:
pi@bpi2:~$ iperf -s -u ------------------------------------------------------------ Server listening on UDP port 5001 Receiving 1470 byte datagrams UDP buffer size: 25.0 MByte (default) ------------------------------------------------------------ [ 3] local 192.168.1.11 port 5001 connected with 192.168.1.201 port 44269 [ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams [ 3] 0.0-10.0 sec 379 MBytes 318 Mbits/sec 0.030 ms 69509/340136 (20%) [ 4] local 192.168.1.11 port 5001 connected with 192.168.1.201 port 53115 [ 4] 0.0-10.0 sec 463 MBytes 389 Mbits/sec 0.022 ms 9715/340137 (2.9%) [ 3] local 192.168.1.11 port 5001 connected with 192.168.1.201 port 39077 [ 3] 0.0-10.0 sec 431 MBytes 362 Mbits/sec 0.031 ms 32537/340136 (9.6%) [ 4] local 192.168.1.11 port 5001 connected with 192.168.1.201 port 47676 [ 4] 0.0-10.0 sec 363 MBytes 305 Mbits/sec 0.029 ms 81019/340136 (24%) [ 3] local 192.168.1.11 port 5001 connected with 192.168.1.201 port 52106 [ 3] 0.0-10.0 sec 407 MBytes 341 Mbits/sec 0.030 ms 49872/340136 (15%)
當我設置最高優先級時:
pi@bpi2:~$ sudo ionice -c 1 -n 0 nice -n -20 iperf -s -u ------------------------------------------------------------ Server listening on UDP port 5001 Receiving 1470 byte datagrams UDP buffer size: 25.0 MByte (default) ------------------------------------------------------------ [ 3] local 192.168.1.11 port 5001 connected with 192.168.1.201 port 59056 [ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams [ 3] 0.0-10.0 sec 460 MBytes 386 Mbits/sec 0.022 ms 11665/340137 (3.4%) [ 4] local 192.168.1.11 port 5001 connected with 192.168.1.201 port 54558 [ 4] 0.0-10.0 sec 450 MBytes 378 Mbits/sec 0.039 ms 18941/340137 (5.6%) [ 3] local 192.168.1.11 port 5001 connected with 192.168.1.201 port 34361 [ 3] 0.0-10.0 sec 437 MBytes 366 Mbits/sec 0.029 ms 28662/340137 (8.4%) [ 4] local 192.168.1.11 port 5001 connected with 192.168.1.201 port 47201 [ 4] 0.0-10.0 sec 474 MBytes 398 Mbits/sec 0.033 ms 1953/340136 (0.57%) [ 3] local 192.168.1.11 port 5001 connected with 192.168.1.201 port 34809 [ 3] 0.0-10.0 sec 442 MBytes 371 Mbits/sec 0.030 ms 24886/340136 (7.3%) [ 4] local 192.168.1.11 port 5001 connected with 192.168.1.201 port 54412 [ 4] 0.0-10.0 sec 429 MBytes 360 Mbits/sec 0.037 ms 34388/340138 (10%) [ 3] local 192.168.1.11 port 5001 connected with 192.168.1.201 port 55946 [ 3] 0.0-10.0 sec 446 MBytes 374 Mbits/sec 0.034 ms 22341/340136 (6.6%)
與此同時,我自己設法找到了解決方案。iperf 出現這種奇怪行為的原因不是應用程序本身,而是 NIC 的驅動程序有問題(很可能與正確設置 GbE 延遲有關)。
幫助的是完全重新安裝作業系統並切換到具有正確驅動程序集的 Armbian 4.19。我設法在 armbian 論壇中找到了解決方案,該論壇為所有對 allwinner h3 SoC 感興趣的人(我的 BananaPi M2+ 以及許多其他產品中使用的那個)提供了非常廣泛的資訊。