Git Product home page Git Product logo

set-ethernet-max-ring-buffer's Introduction

set-ethernet-max-ring-buffer

Intro

Maximizing NIC Ring Buffer is a common task when the host encounters drop packets or loss of data situations on the network. However, the maximum ring buffer values can be different on different NICs.

This small utility will detect the maximum RX/TX ring buffer values and set them to those values on the specified NIC. This could save some time for engineers to investigate and set up commands for tuning ring buffer manually.

In order to make the ring buffer change permanently, please use some facilities that can ensure the command run after OS started.

I developed this utility in both C and Python versions.

Python Version

Dependencies

Following Python packages are needed:

argparse
os
re
subprocess
sys

Usage

This utility needs ethtool utility to read and set ring buffer values. So it needs superuser permission to run.

$ ./set-ethernet-max-ring-buffer.py -h
usage: set-ethernet-max-ring-buffer.py [-h] --device DEVICE

Set max TX/RX ring buffer for ethernet device

options:
  -h, --help       show this help message and exit
  --device DEVICE  Ethernet device name

Example

$ sudo ./set-ethernet-max-ring-buffer.py --device eno1
Setting RX Ring Buffer from 256 to 4096
Setting TX Ring Buffer from 256 to 4096
$ sudo ethtool -g eno1
Ring parameters for eno1:
Pre-set maximums:
RX:		4096
RX Mini:	n/a
RX Jumbo:	n/a
TX:		4096
Current hardware settings:
RX:		4096
RX Mini:	n/a
RX Jumbo:	n/a
TX:		4096

C Version

Dependencies

This C version does not need any extra command dependencies. It utilized related ETHTOOL_* ioctl commands to complete the ring buffer configuration.

Compilation

$ gcc -g -Wall -Wextra -Wpedantic -o set-ethernet-max-ring-buffer set-ethernet-max-ring-buffer.c

Usage

$ ./set-ethernet-max-ring-buffer
usage: ./set-ethernet-max-ring-buffer -d <ethernet device name>

Example

$ sudo ./set-ethernet-max-ring-buffer -d eno1
Setting RX Ring Buffer from 256 to 4096
Setting TX Ring Buffer from 256 to 4096
$ sudo ethtool -g eno1
Ring parameters for eno1:
Pre-set maximums:
RX:             4096
RX Mini:        n/a
RX Jumbo:       n/a
TX:             4096
Current hardware settings:
RX:             4096
RX Mini:        n/a
RX Jumbo:       n/a
TX:             4096

Reference

Monitoring and tuning the RX ring buffer

Queueing in the Linux Network Stack

set-ethernet-max-ring-buffer's People

Contributors

meow-watermelon avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.