排查我的新网络:当万兆以太网仅跑出 300 兆速率时
Debugging my new network, when 10 Gigabit Ethernet Runs at 300 Megabits

原始链接: https://www.hanselman.com/blog/debugging-my-new-network-when-10-gigabit-ethernet-runs-at-300-megabits

尽管配置看起来完全正确,但作者在使用 Windows 台式机连接全新的 UniFi UNAS Pro 8 时,却遇到了 10GbE 网络速度极慢的困扰。在对 NAS、RAID 阵列和 SMB 设置进行了详尽且无果的排查后,作者使用 `iperf3` 对网络进行了隔离测试。 测试显示存在严重的丢包现象和不对称的限速情况,这证实了问题出在 Windows 网络堆栈,而非存储硬件。在调查 Intel E610 网卡统计数据后,作者发现了数千个被丢弃的数据包。增大网卡的接收缓冲区带来了一定的提升,但真正的突破点在于禁用了“IPv4 大量发送卸载 (LSO) V2”。这一项改动使传输速度从约 300 Mbps 提升至 7 Gbps 以上,从而实现了向 NAS 写入 350 MB/s 的持续实际 SMB 速度。 核心启示在于隔离变量的重要性:通过使用 `iperf3` 将存储和文件系统排除在外,作者将问题缩小到了网络层。尽管 LSO 通常是有益的,但作者提醒,根据具体的硬件和驱动程序配置,它有时会导致严重的性能下降。

这篇 Hacker News 帖子讨论了家庭网络的复杂性以及高速网络配置中常见的性能瓶颈成因。 一个反复出现的主题是,现代设备(如电视)普遍配备 100Mbps 以太网端口;虽然这足以满足流媒体需求,但在廉价交换机上可能会导致网络拥塞或出现“木桶效应”。用户还强调,检查物理层(例如确保 SFP+ 模块完全插入)是故障排除的第一步。 技术贡献者指出,网络问题往往源于过时的默认驱动程序设置,例如接收缓冲区过小,无法跟上 10GbE 的速度,以及 PCIe ASPM 或以太网暂停帧等高级功能带来的潜在并发症。此外,还有一个关于游戏机的子讨论;一些用户报告称,索尼的网络实现(包括其对 IPv6 的处理不佳或吞吐量问题)可以通过使用 HTTP 代理或专用网络配置来缓解。最终,共识是:虽然高速硬件越来越容易获得,但性能往往受到糟糕的默认软件配置、旧硬件限制以及“隐形”缓冲区管理问题的阻碍。
相关文章

原文

I've been moving my home storage over to a UniFi UNAS Pro 8 as part of a larger homelab moderization. My main IRONHEART (the ultimate PC from a few years back) desktop now has an Intel E610-XT2 10GbE card, the NAS is on 10GbE, and there's a Minisforum MS-01 miniPC on the same network with a 10GbE SFP+ connection running Immich and Portainer and a few other things.

Everything says 10 gigabit. Windows says 10 gigabit. UniFi says 10 gigabit. SMB copies are using the correct NIC but my file copies are running at around 100 to 200 megabits per second which is sad making.

Naturally, I blamed the NAS, and the spinning rust within. The UNAS has six 16 TB spinning disks in RAID 6 and a pair of NVMe SSDs being used as cache. I'm also running Immich on the MS-01, with its photo library living on the UNAS, so there are lots of thumbnails, metadata reads, and little background writes happening. All seem like reasonable suspects.

I switched the UNAS SSD cache from read-write to read-only. No meaningful difference. I stopped Immich completely. No difference. I looked at iostat; the disks weren't saturated. We looked at SMB signing and Windows Defender network scanning. Still slow.

Then I stopped testing the NAS and ran iperf3 directly between the Windows desktop and the MS-01:

iperf3 -c 192.168.1.222 -P 4

133 Mbit/sec

Oops. The reverse test was better, but still wrong:

iperf3 -c 192.168.1.222 -P 4 -R

1.33 Gbit/sec

That's weird. Now the disks, SMB, Immich, RAID, and the NAS itself were completely out of the equation. This was a Windows/NIC problem and it's weirdly asymmetrical.

Looking at the Intel adapter statistics shows me...

Get-NetAdapterStatistics -Name "Ethernet - 10 Gig Intel"

There were nearly a million ReceivedDiscardedPackets. During one ten-second iperf3 test, the counter increased by another 268. Why?

The E610 driver had its receive buffers at the default 512, although it supported up to 4096. I increased them. I love an increased buffer.

Set-NetAdapterAdvancedProperty `
  -Name "Ethernet - 10 Gig Intel" `
  -DisplayName "Receive Buffers" `
  -DisplayValue "4096"

The discarded-packet count during the next test went from 268 to zero, and receive throughput jumped from 1.33 Gbit/sec to 5.15 Gbit/sec. The transmit direction was still terrible, basically 313 Mbit/sec. The next experiment was disabling Large Send Offload (LSO) V2 for IPv4:

Set-NetAdapterAdvancedProperty `
  -Name "Ethernet - 10 Gig Intel" `
  -DisplayName "Large Send Offload V2 (IPv4)" `
  -DisplayValue "Disabled"

Then I ran the same iperf3 test again.

7.03 Gbit/sec

That's not a typo. 313 Mbit/sec to 7.03 Gbit/sec by changing one NIC setting. Sweet sassy molassey.

LSO exists for a good reason: Windows can hand large TCP buffers to the NIC and let the adapter/driver segment them into network-sized packets, reducing CPU work. Microsoft does, however, explicitly point out that segmentation offload can reduce maximum sustainable throughput with some network adapters/configurations. LSO is usually useful, but not in this case.

In my particular combination of Windows and the Intel E610-XT2, something in the IPv4 LSO path was very, very sad. I don't yet know whether this is an Intel driver bug, firmware issue, Windows interaction, or something particular to this machine, so I wouldn't turn this into random tech blogger advice that everyone should disable LSO. Measure first, cut once. Er, twice. Just stay woke.

Finally I went back to the test that started all this and copied the same large file to the UNAS and Robocopy reported:

Speed : 350,201,354 Bytes/sec.
Speed : 20,038.682 MegaBytes/min.

About 350 MB/sec, or 2.8 Gbit/sec of sustained real-world SMB writes to a six-disk RAID 6 NAS.

That's much more like it. The useful lesson isn't "disable LSO." It was that when storage is mysteriously slow, eventually you have to stop testing storage. iperf3 removed the NAS, filesystem, RAID, cache, SMB and disks from the experiment in one move. Once the raw network was also slow, the problem became dramatically smaller. And, sometimes the little checkbox labeled Large Send Offload is capable of making your 10 gigabit card run like it's 2004.

TL;DR - with LSO V2 for IPv4 enabled, Windows-to-Linux iperf3 managed about 313 Mbit/sec. Turning off that single offload took the exact same test to 7.03 Gbit/sec. I’m deliberately saying on this machine because LSO is normally useful and this isn’t blanket advice to disable it everywhere. 

联系我们 contact @ memedata.com