应调整哪些内核参数来修复 RX 超限?

应调整哪些内核参数来修复 RX 超限?

我有一台 Centos 6 服务器,处理大量流量。我发现 RX 超限一直在增加:

RX packets:11191345002 errors:0 dropped:0 overruns:35592596 frame:0
TX packets:15262461573 errors:0 dropped:0 overruns:0 carrier:0
RX bytes:1871320014951 (1.7 TiB)  TX bytes:12673638434114 (11.5 TiB) 

根据http://www.tldp.org/LDP/nag2/x-087-2-iface.ifconfig.html

当数据包的到达速度快于内核处理最后一个中断的速度时,通常会发生接收器溢出。

应该调整哪些内核参数来解决这个问题?

答案1

我建议使用适合tuned-adm您的 I/O 配置的配置文件。对于此设置,这听起来yum install tuned-utils很有帮助tuned-adm profile enterprise storage

在内核端,您可以设置发送/接收缓冲区:

net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216

我会先尝试一下这些……

如果仍然发现问题,可以使用以下方法检查 NIC 环形缓冲区ethtool -g

Ring parameters for eth0:
Pre-set maximums:
RX:     4096
RX Mini:    0
RX Jumbo:   0
TX:     4096
Current hardware settings:
RX:     256
RX Mini:    0
RX Jumbo:   0
TX:     256

因此,您可以使用将 rx 从 256 修改为 1024 ethtool -G eth0 rx 1024

相关内容