Modify network card cache to solve the problem of losing packets on Linux network card
Bad packet loss for Linux NIC
Production has a Linux device concurrency is relatively large, droped package more, especially when running the game packet, there is a serious loss of packet phenomenon, suspected network card performance is not enough, before the replacement of equipment can not be solved by software method, through some information on the Internet show that this phenomenon, It is also possible that the NIC buffer size is too small for the reason, so try to change the buffer sizes resolved, the following device has been running for 64 days, the packet dropped more than more than 2 billion
Find some foreign articles, you can modify the network card buffer size through Ethtool, first to support the network card, my server is Intel's 1000M network card, we look at Ethtool instructions
-g–show-ringqueries The specified Ethernet device for RX/TX ring parameter information.
-g–set-ringchanges the Rx/tx ring parameters of the specified Ethernet device.
View the buffer size of the current network adapter
Ring parameters for eth0:
Pre-set maximums:
Rx:4096rx mini:0
RX jumbo:0
tx:4096
Current
hardware settings:
rx:256
RX mini:0
RX jumbo:0
tx:256
because my Rx bag is going to have droped, we use
ETHTOOL-G eth0 Rx 2048
The same is true for eth1 ethtool-g eth1 Rx 2048
And look at the changes.
Ring parameters for eth0:
Pre-set maximums:
rx:4096
RX mini:0
RX jumbo:0
tx:4096
Current
hardware settings:
rx:2048
RX mini:0
RX jumbo:0
tx:2048
A few hours later, there was no increase in the packet loss.
Modify network card cache to solve the problem of losing packets on Linux network card