UDP 带宽上的 Iperf 结果

网络工程 通讯协议 带宽 UDP 测试 iperf
2021-07-28 10:20:15

我目前正在测试 iperf,以期为我们公司自动化一些测试服务器。

为此,我在云中使用了 iperf 服务器,该服务器连接良好,距我的客户端仅 5 跳。用于启动服务器的命令是“iperf3 -s”。

我的客户连接到一条低质量的 ADSL 线路,我从长期测试中得知该线路的可用带宽在 500k 到 1500k 之间。

我正在使用各种测试类型进行测试。例如,当我使用 TCP 和默认设置进行测试时,我得到以下输出:

iperf3 -c xxxxxxx.co.uk
Connecting to host xxxxxxx.co.uk, port 5201
[  4] local 192.168.1.102 port 56608 connected to x.x.x.x port 5201
[ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
[  4]   0.00-1.00   sec  95.0 KBytes   778 Kbits/sec    0   16.8 KBytes       
[  4]   1.00-2.00   sec  85.2 KBytes   698 Kbits/sec    0   20.9 KBytes       
[  4]   2.00-3.00   sec  79.6 KBytes   652 Kbits/sec    0   25.1 KBytes       
[  4]   3.00-4.00   sec  74.0 KBytes   607 Kbits/sec    3   19.6 KBytes       
[  4]   4.00-5.00   sec  72.6 KBytes   595 Kbits/sec    0   25.1 KBytes       
[  4]   5.00-6.00   sec  71.2 KBytes   583 Kbits/sec    2   19.6 KBytes       
[  4]   6.00-7.00   sec  61.4 KBytes   503 Kbits/sec    1   19.6 KBytes       
[  4]   7.00-8.00   sec  82.4 KBytes   675 Kbits/sec    0   19.6 KBytes       
[  4]   8.00-9.00   sec  71.2 KBytes   583 Kbits/sec    1   12.6 KBytes       
[  4]   9.00-10.00  sec  72.6 KBytes   595 Kbits/sec    0   19.6 KBytes       
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  4]   0.00-10.00  sec   765 KBytes   627 Kbits/sec    7             sender
[  4]   0.00-10.00  sec   735 KBytes   602 Kbits/sec                  receiver

iperf Done.

这比我预期的要低一点,但我可以接受它大体上是正确的。

当我想测试 udp 性能时,事情变得很奇怪。

如果我使用以下命令测试默认 udp 带宽:iperf3 -c xxxxxxxxx.co.uk -u

我得到以下输出:

Connecting to host xxxxxxxxx.co.uk, port 5201
[  4] local 192.168.1.102 port 41387 connected to x.x.x.x port 5201
[ ID] Interval           Transfer     Bandwidth       Total Datagrams
[  4]   0.00-1.00   sec   128 KBytes  1.05 Mbits/sec  16  
[  4]   1.00-2.00   sec   128 KBytes  1.05 Mbits/sec  16  
[  4]   2.00-3.00   sec   128 KBytes  1.05 Mbits/sec  16  
[  4]   3.00-4.00   sec   128 KBytes  1.05 Mbits/sec  16  
[  4]   4.00-5.00   sec   128 KBytes  1.05 Mbits/sec  16  
[  4]   5.00-6.00   sec   128 KBytes  1.05 Mbits/sec  16  
[  4]   6.00-7.00   sec   128 KBytes  1.05 Mbits/sec  16  
[  4]   7.00-8.00   sec   128 KBytes  1.05 Mbits/sec  16  
[  4]   8.00-9.00   sec   128 KBytes  1.05 Mbits/sec  16  
[  4]   9.00-10.00  sec   128 KBytes  1.05 Mbits/sec  16  
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Jitter    Lost/Total Datagrams
[  4]   0.00-10.00  sec  1.25 MBytes  1.05 Mbits/sec  11.913 ms  136/146 (93%)  
[  4] Sent 146 datagrams

iperf Done.

但是,如果我将带宽设置为 100M,请使用以下命令:

iperf3 -c xxxxxxxx.co.uk -u -b 100M

我得到

Connecting to host xxxxxxx.co.uk, port 5201
[  4] local 192.168.1.102 port 53077 connected to x.x.x.x port 5201
[ ID] Interval           Transfer     Bandwidth       Total Datagrams
[  4]   0.00-1.00   sec  10.5 MBytes  87.9 Mbits/sec  1342  
[  4]   1.00-2.00   sec  10.8 MBytes  90.3 Mbits/sec  1378  
[  4]   2.00-3.00   sec  10.8 MBytes  90.6 Mbits/sec  1382  
[  4]   3.00-4.00   sec  10.8 MBytes  90.8 Mbits/sec  1386  
[  4]   4.00-5.00   sec  10.8 MBytes  90.2 Mbits/sec  1376  
[  4]   5.00-6.00   sec  10.8 MBytes  90.2 Mbits/sec  1376  
[  4]   6.00-7.00   sec  10.8 MBytes  90.3 Mbits/sec  1378  
[  4]   7.00-8.00   sec  10.8 MBytes  90.8 Mbits/sec  1384  
[  4]   8.00-9.00   sec  10.8 MBytes  90.7 Mbits/sec  1384  
[  4]   9.00-10.00  sec  10.8 MBytes  90.5 Mbits/sec  1381  
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Jitter    Lost/Total Datagrams
[  4]   0.00-10.00  sec   108 MBytes  90.2 Mbits/sec  8.214 ms  0/1 (0%)  
[  4] Sent 1 datagrams

iperf Done.

这太疯狂了。我不可能在这条 ADSL 线路上达到 90 Mbits/sec。任何人都可以帮助阐明这一点吗?

1个回答

带有 UDP 的 iperf 2.0.x 有一个特殊性:在发送系统的限制(CPU、NIC、UDP/IP 堆栈及其缓冲区)内,iPerf 将以您使用参数指定有效负载速率发送流量-b(如果省略,iperf 将默认为 1Mbit/s)。

编辑: 哦!直到现在我才发现您实际上在使用 iperf3。我会在这里留下这些评论,都是一样的。

使用 UDP,iPerf 2.0.x 不会打扰或检查接收器/服务器是否获得以及有多少数据,或者即使在-c <ip.addr.ess.here>参数中给出的 IP 地址处确实存在接收器/服务器[1]

iperf 3.x 改变了这一点,因为接收器/服务器端不再区分 UDP 和 TCP,您只需在“服务器模式”下启动 iperf3。客户端将指定是使用 UDP 还是 TCP,并且在执行实际测试之前,客户端和服务器之间会有某种形式的协商。

编辑:如果 iperf3 客户端和服务器协商失败,UDP 测试将不会启动。但是,如果协商成功,i​​perf3 客户端仍会以配置的数据/有效载荷速率发送,无论数据是否以及有多少数据发送到服务器。

因此,对于 UDP 测试,重要的是检查服务器/接收端的结果,而不是客户端/发送端。在 iperf 1.7x 和 2.0.x 上,您需要查看服务器端输出,因为它是在那里生成的。使用 iperf3,您可以使用命令行参数“拉取”服务器端结果--get-server-output

iperf2.0.x 的建议:iperf -s -u -i 1在服务器端运行以获得 1 秒的报告间隔。iperf3.xx 的建议: 运行iperf3 -s服务器端和... -i 1 --get-server-output客户端 这也会给你一些关于你的测试流的 pps 数字的信息,当然还有丢包率,这是有趣的部分。

[1] 尤其是带有 UDP 的 iPerf 2.0.x 的这个特性使它成为一个非常谨慎使用的工具。试图在 100/20 xDSL 线路的上游泵送单个 50Mbit/s UDP 流将使整个接入线路无法使用。