客户端和服务器之间的 iperf 输出差异

客户端和服务器之间的 iperf 输出差异

过去 4 个小时我一直在玩 iperf,但我无法理解为什么客户端和服务器上的结果不同。

考虑客户端上的以下 iperf 输出:

iperf -c 91.121.112.163 -p 2222
------------------------------------------------------------
Client connecting to 91.121.112.163, TCP port 2222
TCP window size: 1.06 MByte (default)
------------------------------------------------------------
[  3] local 10.0.0.160 port 36726 connected with 91.121.112.163 port 2222
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-11.4 sec  1.88 MBytes  1.38 Mbits/sec

以下是服务器上相应的输出:

iperf -V -s -p 2222
------------------------------------------------------------
Server listening on TCP port 2222
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
[  4] local ::ffff:91.121.112.163 port 2222 connected with ::ffff:86.209.154.156 port 36726
[ ID] Interval       Transfer     Bandwidth
[  4]  0.0-19.1 sec  1.88 MBytes   823 Kbits/sec

那么,客户端的上传速度为 1.38Mbits/秒,但服务器的接收速度为 823kbits/秒?

有人能解释一下这些令人困惑的结果吗?

答案1

我认为问题在于客户端正在与缓冲了出站流量的设备进行通信,因此客户端认为在服务器实际收到最后一块数据之前就已经完成了。我在使用 iperf 时经常注意到这一点 - 服务器的逐秒报告比客户端的要稳定得多。我还注意到第一的客户端中的第二个始终是最高吞吐量,我假设它正在填充路径上正在这样做的任何设备的缓冲区。以下是客户端和服务器测试双向整形为 7Mbps 的链接...

------------------------------------------------------------
Client connecting to 204.22.22.104, TCP port 5001
TCP window size: 20.0 KByte (default)
------------------------------------------------------------
[  3] local 10.125.20.100 port 49248 connected with 204.22.22.104 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0- 1.0 sec  1.12 MBytes  9.44 Mbits/sec
[  3]  1.0- 2.0 sec   768 KBytes  6.29 Mbits/sec
[  3]  2.0- 3.0 sec   768 KBytes  6.29 Mbits/sec
[  3]  3.0- 4.0 sec   896 KBytes  7.34 Mbits/sec
[  3]  4.0- 5.0 sec   768 KBytes  6.29 Mbits/sec
[  3]  5.0- 6.0 sec   896 KBytes  7.34 Mbits/sec
[  3]  6.0- 7.0 sec   768 KBytes  6.29 Mbits/sec
[  3]  7.0- 8.0 sec   896 KBytes  7.34 Mbits/sec
[  3]  8.0- 9.0 sec   768 KBytes  6.29 Mbits/sec
[  3]  9.0-10.0 sec   768 KBytes  6.29 Mbits/sec
[  3]  0.0-10.2 sec  8.38 MBytes  6.91 Mbits/sec
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
[  4] local 204.22.22.104 port 5001 connected with 10.125.20.100 port 49248
[ ID] Interval       Transfer     Bandwidth
[  4]  0.0- 1.0 sec   828 KBytes  6.78 Mbits/sec
[  4]  1.0- 2.0 sec   764 KBytes  6.25 Mbits/sec
[  4]  2.0- 3.0 sec   857 KBytes  7.02 Mbits/sec
[  4]  3.0- 4.0 sec   815 KBytes  6.68 Mbits/sec
[  4]  4.0- 5.0 sec   811 KBytes  6.64 Mbits/sec
[  4]  5.0- 6.0 sec   814 KBytes  6.66 Mbits/sec
[  4]  6.0- 7.0 sec   815 KBytes  6.68 Mbits/sec
[  4]  7.0- 8.0 sec   814 KBytes  6.66 Mbits/sec
[  4]  8.0- 9.0 sec   812 KBytes  6.65 Mbits/sec
[  4]  9.0-10.0 sec   806 KBytes  6.60 Mbits/sec
[  4]  0.0-10.6 sec  8.38 MBytes  6.64 Mbits/sec

答案2

来自客户:(重点是我的)

[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-**11.4** sec  1.88 MBytes  1.38 Mbits/sec

从服务器:

[ ID] Interval       Transfer     Bandwidth
[  4]  0.0-**19.1** sec  1.88 MBytes   823 Kbits/sec

由于某种原因,服务器认为测试时间比客户端长约 8 秒。这足以使总带宽(从服务器的角度来看)降至 823 Kbps。

相关内容