UDP 缓冲区的单位是什么,sysctl 参数的文档在哪里?

发布于 2024-09-16 10:24:34 字数 636 浏览 8 评论 0原文

我正在运行 x86_64 RedHat 5.3(内核 2.6.18),并在尝试设置 UDP 缓冲区的上下文中专门查看 sysctl -a 中的 net.core.rmem_max 。接收器应用程序有时会丢失数据包,但我认为缓冲区已经足够大,具体取决于它的含义:

此设置的单位是什么 - 位、字节、数据包或页?如果是位或字节,是来自数据报/有效负载(例如 100 字节)还是网络 MTU 大小(~1500 字节)?如果是页面,页面大小是多少(以字节为单位)?

这是每个系统、每个物理设备 (NIC)、每个虚拟设备 (VLAN)、每个进程、每个线程、每个套接字/每个多播组的最大值吗?

例如,假设我的数据是每条消息 100 字节,每个网络数据包包含 2 条消息,我希望每个套接字能够缓冲 50,000 条消息,并且我在 4 个线程中的每个线程上打开 3 个套接字。 net.core.rmem_max 应该有多大?同样,当我在应用程序内设置套接字选项时,单位是有效负载字节,因此在本例中每个套接字上有 5000000 个字节吗?

最后,一般来说,我如何找到通过 sysctl -a 看到的参数单位的详细信息?我有类似的单位和每个关于其他参数的问题,例如 net.core.netdev_max_backlog 和 net.ipv4.igmp_max_memberships。

谢谢。

I'm running x86_64 RedHat 5.3 (kernel 2.6.18) and looking specifically at net.core.rmem_max from sysctl -a in the context of trying to set UDP buffers. The receiver application misses packets sometimes, but I think the buffer is already plenty large, depending upon what it means:

What are the units of this setting -- bits, bytes, packets, or pages? If bits or bytes, is it from the datagram/ payload (such as 100 bytes) or the network MTU size (~1500 bytes)? If pages, what's the page size in bytes?

And is this the max per system, per physical device (NIC), per virtual device (VLAN), per process, per thread, per socket/ per multicast group?

For example, suppose my data is 100 bytes per message, and each network packet holds 2 messages, and I want to be able to buffer 50,000 messages per socket, and I open 3 sockets per thread on each of 4 threads. How big should net.core.rmem_max be? Likewise, when I set socket options inside the application, are the units payload bytes, so 5000000 on each socket in this case?

Finally, in general how would I find details of the units for the parameters I see via sysctl -a? I have similar units and per X questions about other parameters such as net.core.netdev_max_backlog and net.ipv4.igmp_max_memberships.

Thank you.

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

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

发布评论

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

评论(2

╄→承喏 2024-09-23 10:24:35

您可以查看这些文档。也就是说,其中许多参数的记录确实很差,因此需要进行一些谷歌搜索才能从博客和邮件列表中挖掘出血淋淋的细节。

rmem_max 是每个套接字最大缓冲区,以字节为单位。仔细研究一下,这似乎是接收整个数据包的内存,因此大小也必须包括无论什么/ip/udp 标头的大小 - 尽管这个区域对我来说相当模糊。

但请记住,UDP 不可靠。造成丢失的原因有很多,尤其是交换机和路由器之间——它们也有缓冲区。

You'd look at these docs. That said, many of these parameters really are quite poorly documented, so do expect do do som googling to dig out the gory details from blogs and mailinglists.

rmem_max is the per socket maximum buffer, in bytes. Digging around, this appears to be the memory where whole packets are received, so the size have to include the sizes of whatever/ip/udp headers as well - though this area is quite fuzzy to me.

Keep in mind though, UDP is unreliable. There's a lot of sources for loss, not the least inbetween switches and routers - these have buffers as well.

若水般的淡然安静女子 2024-09-23 10:24:35

它在 socket(7) 手册页中有完整记录(以字节为单位)。

此外,可以使用 SO_RCVBUF 在每个套接字的基础上设置限制(如同一页中所述)。

阅读 socket(7)、ip(7) 和 udp(7) 手册页,了解这些东西如何实际工作的信息。 sysctls 记录在那里。

It is fully documented in the socket(7) man page (it is in bytes).

Moreover, the limit may be set on a per-socket basis with SO_RCVBUF (as documented in the same page).

Read the socket(7), ip(7) and udp(7) man pages for information on how these things actually work. The sysctls are documented there.

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