用于对大数据传输的 udp 和 tcp 性能进行基准测试的实用程序

发布于 2024-12-03 10:28:49 字数 558 浏览 0 评论 0原文

我提到了有关大文件传输的可靠 UDP 与 TCP 的不同主题。然而,在决定选择 UDP 而不是 TCP(并向 UDP 添加可靠性机制)之前,我想对 UDP 和 TCP 的性能进行基准测试。 TCP。 Linux 或 Windows 中是否有任何实用程序可以为我提供此性能基准?

我发现 Iperf 就是这样一个实用程序。但是当我在两台linux机器上使用Iperf同时使用udp和tcp发送数据时,我发现对于10MB的数据,TCP的性能比UDP更好。这让我感到惊讶,因为众所周知 UDP 的性能比 TCP 更好。

我的问题是:

  1. UDP 的性能是否总是比 TCP 好?或者有什么具体的 UDP 优于 TCP 的场景。

  2. 有没有公开的 验证这一事实的基准?

  3. 是否有任何标准实用程序可以测量特定网络上的 tcp 和 udp 性能?

提前致谢

I referred to different threads about reliable UDP vs TCP for large file transfers. However, before making the decision of choosing UDP over TCP ( and add reliability mechanism to UDP ) I want to benchmark performance of UDP & TCP. Is there any utility in linux or windows that can give me this performance benchmark ?

I found Iperf is one such utility. But when I used Iperf on two linux machines to send data using both udp and tcp, I found that TCP performs better than UDP for 10MB of data. This was surprising for me as it is well known fact that UDP performs better than TCP.

My Questions are :

  1. Does UDP always perform better than TCP ? or is there any specific
    scenario where UDP is better than TCP.

  2. Is there any published
    benchmarks for validating this fact ?

  3. Is there any standard utilty to measure tcp and udp performance on a particular network ?

Thanks in Advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

妄断弥空 2024-12-10 10:28:50

差异有两个方面,概念上和实践上。许多有关性能的文档都是 90 年代的,当时 CPU 功率明显快于网络速度,并且网络适配器非常基本。

考虑一下,由于开销较少,UDP 在技术上可以更快,但现代硬件的速度还不够快,甚至无法使数据包大小最小的 1 GigE 通道饱和。从校验和到分段再到完全卸载,任何卡都可以大大加速 TCP。

当您需要多播时,即分发多个接收者时,请使用UDP。当 TCP 窗口和拥塞控制未优化时(例如高延迟、高带宽 WAN 链接),请使用 UDP:例如,请参阅 UDT 和 WAN 加速器。

查找 10 GigE NIC 的任何性能文档。基本问题是硬件速度不够快,无法使 NIC 饱和,因此许多供应商提供了总 TCP/IP 堆栈卸载。还要考虑文件服务器,例如 NetApp 等,如果使用软件,您可能会看到将 MTU 调整为更大的大小以减少 CPU 开销。这在低端设备中很流行,例如来自 ReadyNAS、Synology 等的 SOHO NAS 设备。对于高端设备,如果您卸载整个堆栈,那么如果硬件有能力,可以使用正常的以太网 MTU 大小实现更好的延迟,并且 Jumbograms 变得过时的。

iperf 几乎是网络测试的首选工具,但它并不总是 Windows 平台上最好的工具。你需要看看微软自己的工具NTttcp:

http://msdn.microsoft .com/en-us/windows/hardware/gg463264.aspx

请注意,这些工具更多地用于测试网络而不是应用程序性能。微软的工具走向了极端,基本上有一个大的内存锁定缓冲区排队等待网卡尽快发送,没有交互性。该工具还包括一个预热会话,以确保在测试期间不需要进行 malloc。

The differences have two sides, conceptually and practically. Many documentation regarding performance is from the '90s when CPU power was significantly faster than network speed and network adapters were quite basic.

Consider, UDP can technically be faster due to less overheads but modern hardware is not fast enough to saturate even 1 GigE channels with smallest packet size. TCP is pretty much accelerated by any card from checksumming to segmentation through to full offload.

Use UDP when you need multicast, i.e. distributing to say more than say a few recipients. Use UDP when TCP windowing and congestion control is not optimised, such as high latency, high bandwidth WAN links: see UDT and WAN accelerators for example.

Find any performance documentation for 10 GigE NICs. The basic problem is that hardware is not fast enough to saturate the NIC, so many vendors provide total TCP/IP stack offload. Also consider file servers, such as NetApp et al, if software is used you may see tweaking the MTU to larger sizes to reduce the CPU overheads. This is popular with low end equipment such as SOHO NAS devices from ReadyNAS, Synology, etc. With high end equipment if you offload the entire stack then, if the hardware is capable, better latency can be achieved with normal Ethernet MTU sizes and Jumbograms become obsolete.

iperf is pretty much the one goto tool for network testing, but it will not always be the best on Windows platforms. You need to look at Microsoft's own tool NTttcp:

http://msdn.microsoft.com/en-us/windows/hardware/gg463264.aspx

Note these tools are more about testing the network and not application performance. Microsoft's tool goes to extremes with basically a large memory locked buffer queued up waiting for the NIC to send as fast as possible with no interactivity. The tool also includes a warm up session to make sure no mallocs are necessary during the test period.

自由如风 2024-12-10 10:28:49
  1. UDP 并不总是比 TCP 快。 TCP 性能转向有很多,包括 RSS/vRSS。例如,Linux-on-HyperV 上的 TCP 可以获得 30Gbps,Linux-on-Azure 上的 TCP 可以获得 20G+。 //我认为对于Windows VM来说,也是类似的;在 XEN、KVM、TCP 等其他虚拟平台上也做得更好。

  2. 有很多工具可以测量:iPerf、ntttcp (Windows)、ntttcp-for-Linux、netperf 等:

    iPerf3:https://github.com/esnet/iperf

    Windows NTTTCP:https://gallery.technet.microsoft.com /NTttcp-Version-528-Now-f8b12769

    ntttcp-for-Linux:https://github.com/Microsoft/ntttcp-for- linux

    Netperf:http://www.netperf.org/netperf/

  1. UDP is NOT always faster than TCP. There are many TCP performance turning including RSS/vRSS. For example, TCP on Linux-on-HyperV can get 30Gbps and on Linux-on-Azure can get 20G+. //I think for Windows VM, it is similar; also on other virt platform such XEN, KVM, TCP did even better.

  2. There are lot of tools to measure: iPerf, ntttcp (Windows), ntttcp-for-Linux, netperf, etc:

    iPerf3: https://github.com/esnet/iperf

    Windows NTTTCP: https://gallery.technet.microsoft.com/NTttcp-Version-528-Now-f8b12769

    ntttcp-for-Linux: https://github.com/Microsoft/ntttcp-for-linux

    Netperf: http://www.netperf.org/netperf/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文