快速以太网 UDP 优化接收缓冲区

快速以太网 UDP 优化接收缓冲区

我有一台 Linux 计算机,它必须长期从多个设备(最多 30 个左右)接收流数据。

这台计算机连接到快速以太网局域网(100 Mbps),其他设备也连接到该网络,这意味着它不是专用的。

由于流数据是通过 RTP(UDP)接收的,我注意到一些数据包丢失了:可能是由于交换机/路由器,可能是由于当前的 Linux 操作系统。

在我的测试中我想优化 Linux UDP 缓冲区以管理较高的传入数据流量速率(有时可能高于 50 Mbps)。

这可能吗?在这种情况下哪个参数更关键?我在 /etc/sysctl.conf 中设置了几个参数,但它们可能是错误的……因此非常感谢任何帮助。

我附上此文件的一个示例。计算机有一个2 GB 内存卡片。

提前致谢,

#The maximum socket receive buffer size which may be set by using the SO_RCVBUF socket option: 8 MB
net.core.rmem_max = 8388608
#The maximum socket send buffer size which may be set by using the SO_SNDBUF socket option: 512 KB
net.core.wmem_max = 524288

#The default setting in bytes of the socket receive buffer: 4 MB 
net.core.rmem_default = 4194304
#The default setting in bytes of the socket send buffer: 256 KB
net.core.wmem_default = 262144

# Increase the maximum amount of option memory buffers
net.core.optmem_max = 40960

# Increase the maximum total buffer-space allocatable
# This is measured in units of pages (4096 bytes)
net.ipv4.tcp_mem = 65536 131072 262144
 net.ipv4.udp_mem = 65536 131072 262144

# Increase the write-buffer-space allocatable
net.ipv4.tcp_wmem = 8192 65536 16777216
net.ipv4.udp_wmem_min = 16384

# Disable TCP slow start on idle connections
net.ipv4.tcp_slow_start_after_idle = 0

# If your servers talk UDP, also up these limits
#This is a vector of three integers governing the number of pages allowed for queueing by all UDP sockets. man 7 udp
net.ipv4.udp = 131072   196608  262144
#Minimal size, in bytes, of receive buffers used by UDP sockets in moderation.
net.ipv4.udp_rmem_min = 1073741824

# Increase number of incoming connections backlog
#net.core.netdev_max_backlog=2048

相关内容