iperf 的两个结果之间存在巨大差距

网络工程 iperf
2021-07-16 20:56:56

我曾经iperf -c FOO_NODE -t 120 -i 10用另一个节点 FOO_NODE 测试网络,有时我得到这样的结果:

[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec  3.75 MBytes  3.15 Mbits/sec
[  3] 10.0-20.0 sec  3.75 MBytes  3.15 Mbits/sec
[  3] 20.0-30.0 sec  3.62 MBytes  3.04 Mbits/sec
[  3] 30.0-40.0 sec  3.88 MBytes  3.25 Mbits/sec
[  3] 40.0-50.0 sec  4.25 MBytes  3.57 Mbits/sec
[  3] 50.0-60.0 sec  3.75 MBytes  3.15 Mbits/sec
[  3] 60.0-70.0 sec  4.00 MBytes  3.36 Mbits/sec
[  3] 70.0-80.0 sec  3.62 MBytes  3.04 Mbits/sec
[  3] 80.0-90.0 sec  3.25 MBytes  2.73 Mbits/sec
[  3] 90.0-100.0 sec  3.75 MBytes  3.15 Mbits/sec
[  3] 100.0-110.0 sec  4.38 MBytes  3.67 Mbits/sec
[  3] 110.0-120.0 sec  3.50 MBytes  2.94 Mbits/sec
[  3]  0.0-120.5 sec  45.6 MBytes  3.18 Mbits/sec

都在3~6的范围内

但有时我得到这样的结果:

[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec  54.0 MBytes  45.3 Mbits/sec
[  3] 10.0-20.0 sec  56.6 MBytes  47.5 Mbits/sec
[  3] 20.0-30.0 sec  58.2 MBytes  48.9 Mbits/sec
[  3] 30.0-40.0 sec  58.2 MBytes  48.9 Mbits/sec
[  3] 40.0-50.0 sec  59.4 MBytes  49.8 Mbits/sec
[  3] 50.0-60.0 sec  57.5 MBytes  48.2 Mbits/sec
[  3] 60.0-70.0 sec  58.0 MBytes  48.7 Mbits/sec
[  3] 70.0-80.0 sec  58.2 MBytes  48.9 Mbits/sec
[  3] 80.0-90.0 sec  58.8 MBytes  49.3 Mbits/sec
[  3] 90.0-100.0 sec  58.2 MBytes  48.9 Mbits/sec
[  3] 100.0-110.0 sec  57.6 MBytes  48.3 Mbits/sec
[  3] 110.0-120.0 sec  59.2 MBytes  49.7 Mbits/sec
[  3]  0.0-120.2 sec   694 MBytes  48.5 Mbits/sec

都在40~50的范围内。

而 3~6 次发生的频率更高。

我从ec2中的一个节点到其他云服务器中心的一个节点进行了测试。而且我认为不会有太多拥堵,因为它们都较少使用。

这很奇怪。有什么问题?

3个回答

欢迎来到云计算的缺点!抖动(延迟可变性)和激进的超额订阅您的节点在许多不同的点竞争共享资源,这些资源在公共云中可能会大大超额订阅。

我将通过测量/捕获以下内容来解决这个问题:

  • EC2 到 EC2(云内)iperf 以消除公共 Internet 到其他云服务器的遍历。一定要选择同一个地区和可用区(AZ)内的实例——实例需要在同一个账户中,以确保它们在同一个可用区。
  • 在慢速和快速 iperf 运行期间跟踪路由以确保路径没有发生显着变化,这可能会导致延迟差异。
  • 如果可能,请关闭实例并将其重新启动以希望它移动到不同的计算主机。您的问题可能是“吵闹的邻居”问题。

从您可用的全部带宽中减去的任何东西都会降低您的 iperf 结果。这包括机内和机外的竞争流量。

UDP 具有峰值平均吞吐量所需的过度订阅的缺点,并且存在丢弃数据包的成本。此外,持续的超额订阅不允许中间缓冲区耗尽 - 增加了结束/结束延迟。

因此,应该真正测试 TCP 和 UDP,并且在使用 UDP 时让 iperf 客户端提供 99% 的端/端链路容量的负载。

generalnetworkerror有一个很好的答案。我只想添加一个额外的:iperf 默认使用 TCP,它容易受到 RTT 和拥塞变化的影响。更准确的吞吐量测量是使用-u选项(在客户端和服务器上)来测量使用 UDP 的带宽。确保您还在客户端上设置了带宽目标。摘自 MAN 页面:

GENERAL OPTIONS
   -u, --udp
          use UDP rather than TCP

CLIENT SPECIFIC OPTIONS
   -b, --bandwidth n[KM]
          set target bandwidth to n bits/sec (default 1 Mbit/sec).  This setting requires UDP (-u).

通常,如果您使用 iperf 测量最大吞吐量,您几乎总是想使用 UDP。例外情况是,如果您专门查找 TCP 吞吐量数据。