window和linux之间iperf测试的一个坑(iperf window size)

本文探讨了使用iperf工具测试WiFi吞吐率时遇到的问题。发现由于Windows客户端与Linux服务器之间的TCP窗口大小不同,导致传输速率受限。通过调整Windows端的窗口大小,成功提升了传输速率。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

有次在使用iperf测试wifi吞吐率时候发现了问题,上午测的时候速度还可以,下午就不行了,发现上午是linux对linux,下午是window对linux,先贴测试图如下:

# ./iperf -s -w
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
[  4] local 192.168.0.108 port 5001 connected with 192.168.0.100 port 54743
[ ID] Interval       Transfer     Bandwidth
[  4]  0.0- 3.4 sec  4.40 MBytes  10.8 Mbits/sec
[  5] local 192.168.0.108 port 5001 connected with 192.168.0.100 port 54750
[  5]  0.0- 5.3 sec  18.6 MBytes  29.5 Mbits/sec
C:\Users\Administrator\Desktop\iperf for windows\iperf命令行工具>iperf.exe -c 19
2.168.0.108 -i 1 -t 5
------------------------------------------------------------
Client connecting to 192.168.0.108, TCP port 5001
TCP window size: 8.00 KByte (default)
------------------------------------------------------------
[204] local 192.168.0.100 port 54743 connected with 192.168.0.108 port 5001
[ ID] Interval       Transfer     Bandwidth
[204]  0.0- 1.0 sec  1.16 MBytes  9.76 Mbits/sec
[204]  1.0- 2.0 sec  1.51 MBytes  12.6 Mbits/sec
[204]  2.0- 3.0 sec  1.27 MBytes  10.7 Mbits/sec
[204]  0.0- 3.4 sec  4.40 MBytes  10.8 Mbits/sec

C:\Users\Administrator\Desktop\iperf for windows\iperf命令行工具>iperf.exe -c 19
2.168.0.108 -i 1 -t 5 -w1M
------------------------------------------------------------
Client connecting to 192.168.0.108, TCP port 5001
TCP window size: 1.00 MByte
------------------------------------------------------------
[204] local 192.168.0.100 port 54750 connected with 192.168.0.108 port 5001
[ ID] Interval       Transfer     Bandwidth
[204]  0.0- 1.0 sec  3.91 MBytes  32.8 Mbits/sec
[204]  1.0- 2.0 sec  4.09 MBytes  34.3 Mbits/sec
[204]  2.0- 3.0 sec  3.75 MBytes  31.5 Mbits/sec
[204]  3.0- 4.0 sec  3.87 MBytes  32.4 Mbits/sec
[204]  4.0- 5.0 sec  2.99 MBytes  25.1 Mbits/sec
[204]  0.0- 5.3 sec  18.6 MBytes  29.4 Mbits/sec

发现windows端的默认window size是8.00 KByte,而linux是85.3 KByte (default),当linux做server,windows做client上传(反过来没有问题),会因为windows size导致传输速率受限,当在window 端将window size设置成1M时候,iperf速率有明显上升,10.8 Mbits/sec->29.5 Mbits/sec,执行iperf –help发现
-w, –window #[KM] TCP window size (socket buffer size)
window szie 就是socket buffer size,当两端不统一的时候,会造成传输速率下降,影响真实的测量结果
所以建议在iperf测试的时候,在server和client端都加上-w的参数
iperf -s -w 1M
iperf -c 192.168.0.1 -w 1M -i 1 -t 5

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值