18. Latency from Interrupt Coalescing

Many 29West customers using LBM are concerned about latency. We have helped them troubleshoot latency problems and have sometimes found a significant cause to be interrupt coalescing in Gigabit Ethernet NIC hardware. Fortunately, the behavior of interrupt coalescing is configurable and can generally be adjusted to the particular needs of an application.

As mentioned in Section 17.5, interrupt coalescing represents a trade off between latency and efficiency/performance/throughput. The default for some NICs or drivers is an "adaptive" or "dynamic" interrupt coalescing setting that seems to significantly favor high throughput over low latency. The advice in this section is generally aimed toward changing the default to favor low latency, perhaps at the expense of high throughput.

The details of configuring interrupt coalescing behavior will vary depending on the operating system and perhaps even the type of NIC in use. We have had specific experience with Linux using Intel and Broadcom NICs, and with Windows using Intel NICs.

18.1. Linux Interrupt Coalescing

On Linux, the conventional way to configure interrupt coalescing seems to be the ethtool command. However, some NIC drivers seem to require configuration in other ways. In our experience, if ethtool -c eth0 did not work, then another method was available.

For example, we have seen that with some Intel NICs on Linux, interrupt coalescing is controlled through the modprobe method of configuring loadable drivers. /etc/modprobe.conf might look like this:

options e1000 InterruptThrottleRate=8000

Some default configurations set InterruptThrottleRate to 1 which selects dynamic interrupt coalescing. We have seen significant reductions in latency by changing this to a fixed value (e.g. 8,000) as suggested in Intel Application Note AP-450. Using a value of 8,000 would limit receive latency to 1 second/8000 = 125 μs worst case.

For NICs and drivers configured with ethtool, make sure the adaptive-rx parameter is off for the lowest possible latency. Also check the settings of all of the rx-usecs and rx-frames parameters.

18.2. Windows Interrupt Coalescing

We haven't had as much experience configuring interrupt coalescing on Windows as we have had on Linux. For a given type of NIC, we'd expect the relevant parameters name to be similar to those given for Linux above.

We have seen that increasing the Receive Descriptors parameter helped a customer with Intel NICs avoid UDP loss. It defaulted to 256 and they increased it to 2048. See Figure 3.

Figure 3. Windows Intel NIC Receive Descriptors Parameter Setting

Increasing the Receive Descriptors parameter doesn't change interrupt coalescing settings. It simply increases the size of the ring buffer the NIC uses for receiving. This allows for more interrupt servicing latency before loss.

Note: As shown in the screen shot, each Receive Descriptor requires 2 KB of memory. Our customer's increase to 2048 means that each Intel NIC would allocate 2 MB of physical memory for its receive ring buffer.



Copyright 2004 - 2008 29West, Inc.