Windows iperf3 速度测试比 Linux 慢

Windows iperf3 速度测试比 Linux 慢

硬件设置

  • NAS:酷睿 i3 7100、英特尔 X540T2 10GbE
  • 交换机:Mikrotik CRS305
  • 个人电脑:Ryzen 7 2700、英特尔 X540T2 10GbE
  • 电缆:2 条 Cat 7 电缆

软件设置

  • NAS:Ubuntu 20.04
    alexwang@alex-nas2 ~ (master)> iperf3 --version
    iperf 3.7 (cJSON 1.5.2)
    Linux alex-nas2 5.4.0-47-generic #51-Ubuntu SMP Fri Sep 4 19:50:52 UTC 2020 x86_64
    Optional features available: CPU affinity setting, IPv6 flow label, SCTP, TCP congestion algorithm 
    setting, sendfile / zerocopy, socket pacing, authentication
    
    alexwang@alex-nas2 ~ (master) [255]> sudo sysctl -p
    net.ipv4.ip_forward = 1
    kernel.perf_event_paranoid = -1
    vm.nr_hugepages = 128
    net.core.rmem_max = 134217728
    net.core.wmem_max = 134217728
    net.ipv4.tcp_rmem = 4096 87380 67108864
    net.ipv4.tcp_wmem = 4096 65536 67108864
    net.ipv4.tcp_congestion_control = htcp
    net.ipv4.tcp_mtu_probing = 1
    net.core.default_qdisc = fq
    
  • PC:双启动 Windows 10 2004 和 Arch Linux 最新版本(20200911)
    • Windows 10
      • WSL2 Ubuntu 20.04
      • MTU 1500,TCPWindowSize=1M,
        alexwang@Alex-PC /m/c/U/alexwang> iperf3 --version
        iperf 3.7 (cJSON 1.5.2)
        Linux Alex-PC 4.19.104-microsoft-standard #1 SMP Wed Feb 19 06:37:35 UTC 2020 x86_64
        Optional features available: CPU affinity setting, IPv6 flow label, SCTP, TCP congestion algorithm 
        setting, sendfile / zerocopy, socket pacing, authentication
        
      • 测试iperf3 -c NAS_IP
    • Arch Linux - iperf 3.7 - 测试使用iperf3 -c NAS_IP - MTU 1500,- TCP 调整参数均为内核 5.4.64 的默认值
  • PC 到 NAS RTT:
alexwang@Alex-PC /m/c/U/alexwang> ping 192.168.201.50
PING 192.168.201.50 (192.168.201.50) 56(84) bytes of data.
64 bytes from 192.168.201.50: icmp_seq=1 ttl=63 time=0.598 ms
64 bytes from 192.168.201.50: icmp_seq=2 ttl=63 time=0.550 ms
64 bytes from 192.168.201.50: icmp_seq=3 ttl=63 time=0.528 ms
64 bytes from 192.168.201.50: icmp_seq=4 ttl=63 time=0.612 ms

预期行为

无论我在 PC 上运行什么操作系统(Windows 10 或 Arch Linux),从 PC 到 NAS 的 iperf3 测试速度都应该相同(接近 10Gbps),因为硬件相同。

实际行为

当我在 PC 上启动 Arch Linux 时,我可以获得 10Gbps 的速度(即使使用-P 1)。但在 Windows 10 中,使用 只能获得大约 2.5Gbps 的速度-P 1,使用 的最高速度为 6Gbps -P 8。我希望 Windows 也能通过单一连接实现 10Gbps。

已经尝试过

  • 不要使用 WSL,使用 iperf3 windows 预构建二进制文件https://iperf.fr/iperf-download.php=> 相同速度
  • 将 MTU 增加到 5000(在 NAS、PC 和交换机端口上)=> 抱歉,我忘记了实际数字,但速度并没有加快。(不应该是 MTU 问题,因为具有 1500MTU 的 Arch Linux 仍然可以以 10Gbps 运行)
  • 将 Windows TCPWindowSize 设置为 1M => 我们可以在 8 个连接时获得 6Gbps(以前在 8 个连接时获得 4Gbps),但将其增加到 2M 也没有什么区别
  • 增加 NAS TCP 接收窗口大小 =>(显然这没有什么区别,因为瓶颈在我的 PC 而不是 NAS)
  • 将电缆换成新的。=> 没有区别
  • 在我的 PC 和 NAS 之间交换 NIC。=> 没有区别
  • 禁用 Windows TCP 自动调节 => 速度较慢(单连接 1.8Gbps)
  • 使用 iperf3( iperf3 -w 256k) 手动设置 TCP 窗口大小 => 速度较慢(单连接 1Gbps。当然速度会更慢,因为 iperf3 会选择更大的窗口大小)。但是 iperf3 不支持将窗口大小设置为高于 410k,所以我无法尝试高窗口大小。
    alexwang@Alex-PC /m/c/U/alexwang [1]> iperf3 -c 192.168.201.50 -w 420k
    Connecting to host 192.168.201.50, port 5201
    iperf3: error - socket buffer size not set correctly
    

其他可能相关的观察结果

  • 当我在运行 Windows 的电脑上运行时iperf3 -c NAS_IP -R,我发现整个系统变慢了,任务管理器中的系统进程占用了 10% 的 CPU。
  • 本地测试可达到15Gbps
    # on Windows PC powershell
    .\iperf3 -s -p 41111
    # also on Windows PC powershell, 192.168.201.60 is my Windows PC Intel X540 NIC IP
    .\iperf3 -c 192.168.201.60 -p 41111
    

我猜

  • 我不熟悉 Windows,所以我想我错过了一些导致速度缓慢的 Windows TCP 调整,但我不知道是哪一个。
  • 我想知道如何解决这个问题,或者至少知道我应该尝试或学习哪些其他方法以更接近这个问题。

更新

  • 更新1.修复格式

相关内容