Modify NIC Ring Buffer

Modify NIC Ring Buffer

Working on fairly busy systems might come across issues where we get to see the throughput as a bottle neck.

Most of the default network configuration which are provided in Linux are not modified by many while working on enterprise grade application. One of these settings is the NIC Ring Buffer size.

You might need to modify this on systems which receive high traffic volume.

Modify NIC Ring Buffer

As a rule of thumb, smaller the buffer lower the latency. Which is the reason the NIC ring buffer size is set to a lower value. This approach however, affects the throughput. This approach comes with a price of high throughput. So if you want the system provide a higher throughput, don’t be afraid to bump this number up. On most systems we modify the receive (rx) ring buffer size.

You can verify the current NIC ring buffer size using the following command.

ethtool -g ethX

Where, -g will provide the rx and tx ring parameters for the device mentioned as ethX. You can replace it with the device you want to check the ring parameters for.

Let’s consider the following example.

[root@gagan ~]# ethtool -g eth0
Ring parameters for eth0:
Pre-set maximums:
RX:             4096
RX Mini:        0
RX Jumbo:       0
TX:             4096
Current hardware settings:
RX:             512
RX Mini:        0
RX Jumbo:       0
TX:             512

The above output has two sections. The “Pre-set maximums” section provides the maximum value which can be set for each of the parameters for this device. The “Current hardware settings” section provides the current values set for the parameters.

In this case, the current receive ring buffer is 512 which can be bumped up.

Let’s push the RX parameter to 2048.

The following command will achieve this.

ethtool -G eth0 rx 2048

Verify the changes using the -g flag.

Please note that these changes are made to the NIC and not the operating system. The changes made through the above command are modified in NIC firmware and not inside the kernel.

Modify NIC Ring Buffer

No Comments

Post a Comment

Time limit is exhausted. Please reload CAPTCHA.