linux - rmem_default 大小是每个套接字还是整个堆栈?

标签 linux performance sockets networking

设置 net.core.rmem_default 会影响系统中打开的每个套接字或所有套接字吗? 我可以为 net.core.rmem_default 参数配置的最大值是多少?

我知道这取决于 RAM。假设我有很多 RAM 可用。

最佳答案

net.core.rmem_default 是每个套接字的传入内核套接字缓冲区的大小。

来自 man socket(7) :

SO_RCVBUF

Sets or gets the maximum socket receive buffer in bytes. The kernel doubles this value (to allow space for bookkeeping overhead) when it is set using setsockopt(2), and this doubled value is returned by getsockopt(2). The default value is set by the /proc/sys/net/core/rmem_default file, and the maximum allowed value is set by the /proc/sys/net/core/rmem_max file. The minimum (doubled) value for this option is 256.

最佳传入套接字缓冲区大小为 the bandwidth-delay product .

为了最小化recv 系统调用,您的用户空间套接字缓冲区大小不应小于内核缓冲区的大小。使用非阻塞 I/O 时,必须发出多个 recv 系统调用来读取内核套接字缓冲区可能会导致其他套接字饥饿。

关于linux - rmem_default 大小是每个套接字还是整个堆栈?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44067218/

相关文章:

linux - 使用 ZeroMQ 流连接到设备失败,但 Linux 套接字工作

C++ boost::thread,如何在类中启动线程

linux - 尽管交换内存是从辅助内存中获取的,但为什么交换内存比辅助内存更快

c - 如何确定 pid_t 的最大值?

opengl - 在OpenGL中绘制许多球体

sockets - ReadFromUDP 不阻塞

java - 多次迭代列表的性能成本是多少

performance - 有人可以解释两个查询之间的区别吗?

iphone - 使用套接字接收损坏/不完整的消息

java - 使用套接字通信托管 Java 服务器