Tuesday, June 29, 2010

packet drops in Linux

Packet drops can happen at two layers. one at the NIC level or at the Network stack 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".
 

5 comments:

  1. HappyLiving,

    This solved a huge problem I was having on my research project. The interface was dropping thousands of packets every few seconds (even at low bitrates such as 2.0 Gbps). When I made this change, packets were only dropping at high bitrates (e.g. 5.0 Gbps).

    Thanks!

    ReplyDelete
  2. Will this change survive a reboot of the system? or do you have to change a parameter elsewhere in order for the change to be permanent?

    ReplyDelete
  3. is it requires to down and up the ethernet?

    ReplyDelete