我在同一虚拟机管理程序上的两个虚拟机之间进行了 UDP iperf 2.0.5-Ubuntu 测试。如下面的 iperf 输出所示,我使用“-b 686M”标志开始了我的第一次测试。但是,iperf 报告说它只能以 633Mbps(目标带宽的 92%)发送流量。然后,我将目标带宽降低到 633Mbps。但是,iperf 再次只能以 604Mbps(目标带宽的 95%)发送流量。然后我一直这样做,直到它达到 561Mbps 的某种平衡,最终目标带宽与实际带宽一致。
这是怎么回事?为什么 iperf 发送流量的速率低于指定的目标带宽?显然,从第一次测试运行来看,如果 iperf 真的愿意的话,它有足够的 CPU 资源来生成 686Mbps 的流量。
root@ubuntu:/# iperf -u -c 192.168.71.135 -b 686M -t 10
------------------------------------------------------------
Client connecting to 192.168.71.135, UDP port 5001
Sending 1470 byte datagrams
UDP buffer size: 208 KByte (default)
------------------------------------------------------------
[ 3] local 192.168.71.136 port 37449 connected with 192.168.71.135 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0-10.0 sec 754 MBytes 633 Mbits/sec
[ 3] Sent 538085 datagrams
[ 3] Server Report:
[ 3] 0.0-10.0 sec 754 MBytes 633 Mbits/sec 0.012 ms 40/538084 (0.0074%)
[ 3] 0.0-10.0 sec 1 datagrams received out-of-order
root@ubuntu:/# iperf -u -c 192.168.71.135 -b 633M -t 10
------------------------------------------------------------
Client connecting to 192.168.71.135, UDP port 5001
Sending 1470 byte datagrams
UDP buffer size: 208 KByte (default)
------------------------------------------------------------
[ 3] local 192.168.71.136 port 58953 connected with 192.168.71.135 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0-10.0 sec 720 MBytes 604 Mbits/sec
[ 3] Sent 513420 datagrams
[ 3] Server Report:
[ 3] 0.0-10.0 sec 720 MBytes 604 Mbits/sec 0.016 ms 49/513419 (0.0095%)
[ 3] 0.0-10.0 sec 1 datagrams received out-of-order
root@ubuntu:/# iperf -u -c 192.168.71.135 -b 604M -t 10
------------------------------------------------------------
Client connecting to 192.168.71.135, UDP port 5001
Sending 1470 byte datagrams
UDP buffer size: 208 KByte (default)
------------------------------------------------------------
[ 3] local 192.168.71.136 port 45411 connected with 192.168.71.135 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0-10.0 sec 695 MBytes 583 Mbits/sec
[ 3] Sent 495600 datagrams
[ 3] Server Report:
[ 3] 0.0-10.0 sec 695 MBytes 583 Mbits/sec 0.015 ms 199/495599 (0.04%)
[ 3] 0.0-10.0 sec 1 datagrams received out-of-order
root@ubuntu:/# iperf -u -c 192.168.71.135 -b 583M -t 10
------------------------------------------------------------
Client connecting to 192.168.71.135, UDP port 5001
Sending 1470 byte datagrams
UDP buffer size: 208 KByte (default)
------------------------------------------------------------
[ 3] local 192.168.71.136 port 56228 connected with 192.168.71.135 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0-10.0 sec 669 MBytes 561 Mbits/sec
[ 3] Sent 477143 datagrams
[ 3] Server Report:
[ 3] 0.0-10.0 sec 669 MBytes 561 Mbits/sec 0.013 ms 4/477142 (0.00084%)
[ 3] 0.0-10.0 sec 1 datagrams received out-of-order
root@ubuntu:/# iperf -u -c 192.168.71.135 -b 561M -t 10
------------------------------------------------------------
Client connecting to 192.168.71.135, UDP port 5001
Sending 1470 byte datagrams
UDP buffer size: 208 KByte (default)
------------------------------------------------------------
[ 3] local 192.168.71.136 port 41766 connected with 192.168.71.135 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0-10.0 sec 669 MBytes 561 Mbits/sec
[ 3] Sent 477264 datagrams
[ 3] Server Report:
[ 3] 0.0-10.0 sec 669 MBytes 561 Mbits/sec 0.013 ms 405/477263 (0.085%)
[ 3] 0.0-10.0 sec 1 datagrams received out-of-order
root@ubuntu:/# iperf -u -c 192.168.71.135 -b 561M -t 10