为什么在 UDP iperf 测量期间传输的数据量存在差异?

网络工程 UDP 吞吐量 iperf
2022-02-18 19:37:11

我从 iperf3 测量的 UDP 吞吐量测试中得到以下结果

$ iperf3 -u -t 10 -c 192.168.1.2 -b 100M -V
iperf 3.6+
Linux pi-raspberry1 4.4.38-v7+ #938 SMP Thu Dec 15 15:22:21 GMT 2016 armv7l
Control connection MSS 1448
Setting UDP block size to 1448
Time: Thu, 04 Oct 2018 09:58:29 GMT
Connecting to host 192.168.1.2, port 5201
      Cookie: h3wj4by4mtyobgtq42gsf62s3nfhymg6djry
[  5] local 192.168.1.1 port 40988 connected to 192.168.1.2 port 5201
Starting Test: protocol: UDP, 1 streams, 1448 byte blocks, omitting 0 seconds, 10 second test, tos 0
[ ID] Interval           Transfer     Bitrate         Total Datagrams
[  5]   0.00-1.00   sec  3.34 MBytes  28.0 Mbits/sec  2421
[  5]   1.00-2.00   sec  3.13 MBytes  26.2 Mbits/sec  2264
[  5]   2.00-3.00   sec  2.15 MBytes  18.1 Mbits/sec  1560
[  5]   3.00-4.00   sec   905 KBytes  7.41 Mbits/sec  640
[  5]   4.00-5.00   sec   486 KBytes  3.98 Mbits/sec  344
[  5]   5.00-6.00   sec  2.19 MBytes  18.4 Mbits/sec  1587
[  5]   6.00-7.00   sec  2.55 MBytes  21.4 Mbits/sec  1848
[  5]   7.00-8.00   sec  2.18 MBytes  18.3 Mbits/sec  1576
[  5]   8.00-9.00   sec  2.72 MBytes  22.8 Mbits/sec  1968
[  5]   9.00-10.00  sec  3.21 MBytes  26.9 Mbits/sec  2321
- - - - - - - - - - - - - - - - - - - - - - - - -
Test Complete. Summary Results:
[ ID] Interval           Transfer     Bitrate         Jitter    Lost/Total Datagrams
[  5]   0.00-10.00  sec  22.8 MBytes  19.1 Mbits/sec  0.000 ms  0/16529 (0%)  sender
[  5]   0.00-10.77  sec  22.8 MBytes  17.8 Mbits/sec  22.003 ms  4/16529 (0.024%)  receiver
CPU Utilization: local/sender 9.8% (1.5%u/8.2%s), remote/receiver 1.5% (0.0%u/1.5%s)

如果 UDP 不断地发送数据而不关心它们是否到达,为什么每秒发送的 MBytes 的数量和发送的总数据报的数量不同?此外,我看到服务器和客户端在摘要结果中看到相同数量的 MBytes,但比特率不一样,这是否与服务器考虑的更大间隔(10.77 秒而不是10)?

2个回答

这是运行当前 Raspbian 的 iperf3 客户端 RaspberryPi3B 到运行当前 Fedora 29 x86_64 的 iperf3 服务器 MacbookPro8,2,通过便宜的 DLink DGS-1005A 千兆以太网交换机,参数与问题中的 pi-raspberry1 测试相同:

$ iperf3 -u -t 10 -c 192.168.255.43 -b 100M -V
iperf 3.1.3
Linux vk5tu 4.14.79-v7+ #1159 SMP Sun Nov 4 17:50:20 GMT 2018 armv7l
Time: Sun, 18 Nov 2018 12:57:31 GMT
Connecting to host 192.168.255.43, port 5201
      Cookie: vk5tu.1542545851.946174.2f2a05466
[  4] local 192.168.255.21 port 43811 connected to 192.168.255.43 port 5201
Starting Test: protocol: UDP, 1 streams, 8192 byte blocks, omitting 0 seconds, 10 second test
[ ID] Interval           Transfer     Bandwidth       Total Datagrams
[  4]   0.00-1.00   sec  10.4 MBytes  86.8 Mbits/sec  1325  
[  4]   1.00-2.00   sec  11.4 MBytes  95.8 Mbits/sec  1462  
[  4]   2.00-3.00   sec  11.4 MBytes  95.8 Mbits/sec  1462  
[  4]   3.00-4.00   sec  11.4 MBytes  95.8 Mbits/sec  1462  
[  4]   4.00-5.00   sec  11.4 MBytes  95.9 Mbits/sec  1463  
[  4]   5.00-6.00   sec  11.4 MBytes  95.8 Mbits/sec  1462  
[  4]   6.00-7.00   sec  11.4 MBytes  95.9 Mbits/sec  1463  
[  4]   7.00-8.00   sec  11.4 MBytes  95.8 Mbits/sec  1462  
[  4]   8.00-9.00   sec  11.4 MBytes  95.9 Mbits/sec  1463  
[  4]   9.00-10.00  sec  11.4 MBytes  95.8 Mbits/sec  1462  
- - - - - - - - - - - - - - - - - - - - - - - - -
Test Complete. Summary Results:
[ ID] Interval           Transfer     Bandwidth       Jitter    Lost/Total Datagrams
[  4]   0.00-10.00  sec   113 MBytes  94.9 Mbits/sec  0.024 ms  0/14486 (0%)  
[  4] Sent 14486 datagrams
CPU Utilization: local/sender 19.3% (0.5%u/18.8%s), remote/receiver 0.1% (0.0%u/0.1%s)

pi-raspberry1 软件的出处是什么?与现有的 Raspbian 相比:pi-raspberry1 的内核要老得多;pi-raspberry1 的 iperf3 版本较新。如果您编译了较新的 iperf3,您是否通过 Debian 打包系统来确保您使用相同的编译器选项和补丁进行编译?

注意 CPU 的差异:pi-raspberry1: 9.8% (1.5%u/8.2%s); vk5tu 19.3% (0.5%u/18.8%s)。您是否在测试期间检查了 CPU 使用率以确保传输不受 CPU 限制?此外,RPi 上的 USB 总线在以太网、WLAN 和 USB 端口之间共享,因此 USB 总线在运行 iperf 测试时不需要其他流量。pi-raspberry1 使用的系统 CPU 是 vk5tu 的三倍,而吞吐量仅为 vk5tu 的 20%,这表明 pi-raspberry1 不是最新的 RPi 硬件,或者内核从 4.4.38(2016 年 12 月)开始有了实质性改进至 4.14.79(2018 年 11 月)。

您是否使用库存电流系统重复了测试?

从上面可以看出,在询问性能问题时,提供大量有关测试环境的信息非常重要。最良好的祝愿。

编辑:

为了您的帮助,这里是没有输出起搏的相同测试,以强调 RPi3B:

$ iperf3 -u -t 10 -c 192.168.255.43 -b0 -V
iperf 3.1.3
Linux vk5tu 4.14.79-v7+ #1159 SMP Sun Nov 4 17:50:20 GMT 2018 armv7l
Time: Sun, 18 Nov 2018 13:16:45 GMT
Connecting to host 192.168.255.43, port 5201
      Cookie: vk5tu.1542547005.185182.16ba7c754
[  4] local 192.168.255.21 port 39955 connected to 192.168.255.43 port 5201
Starting Test: protocol: UDP, 1 streams, 8192 byte blocks, omitting 0 seconds, 10 second test
[ ID] Interval           Transfer     Bandwidth       Total Datagrams
[  4]   0.00-1.01   sec  11.6 MBytes  96.4 Mbits/sec  1480  
[  4]   1.01-2.01   sec  11.4 MBytes  95.8 Mbits/sec  1460  
[  4]   2.01-3.00   sec  11.4 MBytes  95.8 Mbits/sec  1460  
[  4]   3.00-4.00   sec  11.4 MBytes  95.8 Mbits/sec  1460  
[  4]   4.00-5.00   sec  11.4 MBytes  95.8 Mbits/sec  1460  
[  4]   5.00-6.01   sec  11.5 MBytes  95.8 Mbits/sec  1470  
[  4]   6.01-7.00   sec  11.4 MBytes  95.8 Mbits/sec  1460  
[  4]   7.00-8.00   sec  11.4 MBytes  95.8 Mbits/sec  1460  
[  4]   8.00-9.00   sec  11.4 MBytes  95.8 Mbits/sec  1460  
[  4]   9.00-10.01  sec  11.5 MBytes  95.9 Mbits/sec  1470  
- - - - - - - - - - - - - - - - - - - - - - - - -
Test Complete. Summary Results:
[ ID] Interval           Transfer     Bandwidth       Jitter    Lost/Total Datagrams
[  4]   0.00-10.01  sec   114 MBytes  95.9 Mbits/sec  0.940 ms  0/11552 (0%)  
[  4] Sent 11552 datagrams
CPU Utilization: local/sender 18.5% (1.1%u/17.4%s), remote/receiver 1.7% (0.2%u/1.4%s)

正如@vk5tu 回答的那样,低比特率和每个间隔发送数据报的差异可能是由于设备本身的限制。在这个特定的时间点,设备可以生成并放在网络上的数据报数是多少。这些限制可以在 CPU、总线或 NIC(缓冲区)级别。这就是为什么根据您在设备上运行的负载,您会看到不同的结果。

关于发送方/接收方比特率差异,确实是由于间隔不同。接收方需要 10.77 秒才能看到所有传入的数据包:

  • 发件人
    • 16529 个 1448 字节的数据报:23933992 字节或大约 191.47 Mbits
    • 10 秒内收到 191.47 Mbits:19.147 Mbits/s
  • 接收方(丢失 4 个数据报)
    • 16525 个 1448 字节的数据报:23928200 字节或大约 191.43 Mbits
    • 在 10.77 秒内收到 191.43 Mbits:17.774 Mbits/s