The Interrupt Storm Problem
Without any mitigation, a NIC receiving 10 million packets per second would fire 10 million interrupts per second at the CPU. Each interrupt forces a context switch: the CPU saves its current register state, jumps to the interrupt handler, processes the event, and restores state. At 10 million interrupts per second, the CPU spends essentially all of its time on context switching overhead and has no cycles left for actual work. This is called an interrupt storm and it effectively halts the system.
Interrupt Coalescing (also called Interrupt Moderation) is a NIC feature that batches interrupts. Instead of firing an interrupt for every packet, the NIC waits for one of two conditions before firing a single interrupt:
- A time threshold is reached: e.g., "fire an interrupt every 50 microseconds regardless of packet count."
- A packet count threshold is reached: e.g., "fire an interrupt after 64 packets have accumulated."
The NIC fires whichever threshold is hit first. The result: instead of 10 million interrupts per second, the CPU might receive 20,000 interrupts per second, each representing a batch of ~500 packets.
The Latency vs. Throughput Trade-off
Interrupt coalescing introduces a deliberate delay: the first packet in a batch waits in the NIC's buffer until the coalescing threshold is met before the CPU is notified. This delay is typically 10–100 microseconds—imperceptible for most applications, but significant for latency-sensitive workloads.
| Workload | Recommended Setting |
|---|---|
| High-frequency trading, real-time control | Low or disabled coalescing |
| Web servers, databases, general purpose | Default (moderate coalescing) |
| Bulk data transfer, backup, replication | High coalescing (maximize throughput) |
| Kubernetes nodes (mixed workloads) | Default; tune per-application if needed |
Viewing and Adjusting Coalescing Settings
The NIC driver exposes both the time threshold (rx-usecs) and the frame-count threshold (rx-frames) as directly readable and tunable values, separately for receive and transmit. Raising the time threshold trades latency for throughput; setting both thresholds to their minimum effectively disables coalescing for the lowest possible latency.
Key Point: Interrupt coalescing trades microseconds of added latency for dramatic reductions in CPU interrupt overhead. It is enabled by default on all modern NICs with sensible defaults. Only tune it when you have measured evidence that the default is wrong for your specific workload—either too much latency for a trading application or too much CPU overhead for a bulk transfer server.