当使用SO_RCVBUF为10485760(这也是sysctl的net.core.rmem_max设置所规定的电stream限制,并且发送UDP数据包的速度比接收端能够处理rx_queue , /proc/net/udp的rx_queue列总是增长到SO_RCVBUF两倍,20972544是我能观察到的最高值。
那么SO_RCVBUF不被遵守 ? 或者是/ proc / net / udp的输出错误?
我的系统:
uname -a Linux mybox 4.3.0-1-amd64 #1 SMP Debian 4.3.3-5 (2016-01-04) x86_64 GNU/Linux
从套接字(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.
请注意,手册页指出内核将为指定的缓冲区值增加两倍的记帐开销。