对于最大吞吐量,UDP 数据包的最佳大小是多少? [英] What is the optimal size of a UDP packet for maximum throughput?

查看:23
本文介绍了对于最大吞吐量,UDP 数据包的最佳大小是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要通过可能有损网络将数据包从一台主机发送到另一台主机.为了最大限度地减少数据包延迟,我不考虑 TCP/IP.但是,我希望最大化使用 UDP 的吞吐量.要使用的 UDP 数据包的最佳大小应该是多少?

I need to send packets from one host to another over a potentially lossy network. In order to minimize packet latency, I'm not considering TCP/IP. But, I wish to maximize the throughput uisng UDP. What should be the optimal size of UDP packet to use?

以下是我的一些考虑:

  • 网络中交换机的MTU大小为1500.如果我使用大包,例如8192,这会造成碎片.丢失一个片段会导致整个数据包丢失,对吧?

  • The MTU size of the switches in the network is 1500. If I use a large packet, for example 8192, this will cause fragmentation. Loss of one fragment will result in the loss of the entire packet, right?

如果我使用较小的数据包,我会产生 UDP 和 IP 标头的开销

If I use smaller packets, I'll incur the overhead of the UDP and IP header

如果我使用非常大的数据包,我可以使用的最大数据包是多少?我读到最大的数据报大小是 65507.我应该使用什么缓冲区大小来允许我发送这样的大小?这会有助于提高我的吞吐量吗?

If I use a really large packet, what is the largest that I can use? I read that the largest datagram size is 65507. What is the buffer size I should use to allow me to send such sizes? Would that help to bump up my throughput?

常见操作系统(例如 Windows、Linux 等)支持的典型最大数据报大小是多少?

What are the typical maximum datagram size supported by the common OSes (eg. Windows, Linux, etc.)?

更新:

一些数据的接收者是没有实现 TCP/IP 堆栈的嵌入式系统.

Some of the receivers of the data are embedded systems for which TCP/IP stack is not implemented.

我知道这个地方到处都是非常热衷于使用可用资源的人.但我希望能得到比只关注 MTU 更好的答案.

I know that this place is filled with people who are very adament about using what's available. But I hope to have better answers than just focusing on MTU alone.

推荐答案

另一种答案:小心不要重新发明轮子.

Alternative answer: be careful to not reinvent the wheel.

TCP 是数十年网络经验的产物.它所做的每一件事或几乎每一件事都有一个共鸣.它有几种大多数人不经常考虑的算法(拥塞控制、重传、缓冲区管理、处理重新排序的数据包等等).

TCP is the product of decades of networking experience. There is a reson for every or almost every thing it does. It has several algorithms most people do not think about often (congestion control, retransmission, buffer management, dealing with reordered packets, and so on).

如果您开始重新实现所有 TCP 算法,您可能会遇到 (paraphasing Greenspun 的第十条规则) 临时的、非正式指定的、漏洞百出、缓慢的 TCP 实现".

If you start reimplementing all the TCP algorithms, you risk ending up with an (paraphasing Greenspun's Tenth Rule) "ad hoc, informally-specified, bug-ridden, slow implementation of TCP".

如果您还没有这样做,最好看看最近的一些 TCP/UDP 替代方案,例如 SCTP 或 DCCP.它们是为 TCP 和 UDP 都不是很好匹配的领域而设计的,正是为了允许人们使用已经调试过"的协议,而不是为每个新应用程序重新发明轮子.

If you have not done so yet, it could be a good idea to look at some recent alternatives to TCP/UDP, like SCTP or DCCP. They were designed for niches where neither TCP nor UDP was a good match, precisely to allow people to use an already "debugged" protocol instead of reinventing the wheel for every new application.

这篇关于对于最大吞吐量,UDP 数据包的最佳大小是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆