When examining network performance tuning in Linux, the ethtool -c
output reveals critical parameters for interrupt coalescing - a technique that balances between latency and CPU utilization by grouping network interrupts.
Static Coalescing:
rx-usecs: 18 # Microseconds to delay RX interrupt after packet arrival
rx-frames: 12 # Max packets received before triggering interrupt
tx-usecs: 80 # Microseconds delay for TX interrupts
tx-frames: 20 # Max packets sent before TX interrupt
IRQ-specific Settings:
rx-usecs-irq: 18 # IRQ-specific RX delay
rx-frames-irq: 2 # IRQ-specific RX frame count
When adaptive mode is enabled (shown as on/off in output), the driver dynamically adjusts coalescing based on:
pkt-rate-low: 0 # Threshold for low packet rate mode
pkt-rate-high: 0 # Threshold for high packet rate mode
sample-interval: 0 # Window for packet rate measurement
To optimize a web server handling bursts of small packets:
sudo ethtool -C eth0 rx-usecs 50 rx-frames 32 tx-usecs 100 tx-frames 64
sudo ethtool -C eth0 adaptive-rx on adaptive-tx on
Higher values (tradeoff):
- + Reduces CPU interrupts
- - Increases packet latency
Lower values (tradeoff):
- + Improves latency
- - Increases CPU utilization
Check interrupt counts before/after changes:
cat /proc/interrupts | grep eth0
Monitor CPU usage during network load:
mpstat -P ALL 1
Note that implementation varies by NIC driver:
# Intel igb driver example
ethtool -c eth0 | grep -i itr
# Shows additional Intel-specific parameters
When examining ethtool -c
output, we're dealing with parameters that control how network interrupts are aggregated (coalesced) before triggering CPU interrupts. This mechanism significantly impacts latency vs. throughput trade-offs in network performance tuning.
Let's analyze the sample output structure:
Adaptive RX: off TX: off
stats-block-usecs: 999936
sample-interval: 0
The adaptive coalescing being off
means static settings are used. stats-block-usecs
defines how often statistics are updated (in microseconds), while sample-interval
controls dynamic coalescing adjustment frequency.
The most critical settings control interrupt triggering:
rx-usecs: 18 # Max microseconds before RX interrupt
rx-frames: 12 # Max frames before RX interrupt
tx-usecs: 80 # Max microseconds before TX interrupt
tx-frames: 20 # Max frames before TX interrupt
Lower values reduce latency but increase CPU load. Higher values improve throughput but may increase latency.
These parameters apply when the interface is in interrupt context:
rx-usecs-irq: 18
rx-frames-irq: 2
tx-usecs-irq: 18
tx-frames-irq: 2
Typically more aggressive (smaller values) than normal operation to ensure timely interrupt handling.
For a latency-sensitive application (e.g., HFT):
sudo ethtool -C eth0 rx-usecs 10 tx-usecs 20 rx-frames 1 tx-frames 1
For a throughput-oriented server:
sudo ethtool -C eth0 rx-usecs 100 tx-usecs 200 rx-frames 32 tx-frames 32
To enable adaptive coalescing (requires driver support):
sudo ethtool -C eth0 adaptive-rx on adaptive-tx on
The system will then automatically adjust based on packet rates defined by:
pkt-rate-low: 0
pkt-rate-high: 0
Always check applied settings:
ethtool -c eth0 | grep -E 'Adaptive|usecs|frames'
And monitor performance impact with tools like:
sar -n DEV 1
ethtool -S eth0