Tuesday, 19 May 2015

Packet Drop issue

Packet drops can happen at two layers. one at the NIC level or at the Network stack level.

1. Nic level:-

 Check 'ifconfig' output.

RX packets:297126179 errors:0 dropped:3981 overruns:0 frame:0
TX packets:233589229 errors:0 dropped:0 overruns:0 carrier:0

That means packets drops at the NIC level. These are most likely caused by exhaustion of the RX ring buffer. Increase the size of the Ethernet device ring buffer.

First inspect the output of "ethtool -g eth0". If the "Pre-set maximums" are more than the what's listed in the current hardware settings it's recommend to increase this number. As an example:
# ethtool -g eth0

Ring parameters for eth0:
Pre-set maximums:
RX: 1020
RX Mini: 0
RX Jumbo: 16320
TX: 255
Current hardware settings:
RX: 255
RX Mini: 0
RX Jumbo: 0
TX: 255

To increase the RX ring buffer to 4080 you would run "ethtool -G eth0 rx 1020".

2. Network stack level:-

Need  to tweak sysctl kernel parameters.
sysctl -w net.core.wmem_max=33554432
sysctl -w net.core.wmem_default=33554432
sysctl -w net.core.rmem_default=33554432