NIC Interrupt Affinity
When a Docker container uses the NIC passthrough function, you can bind NIC interrupts to CPUs to maximize the network performance and avoid network bottlenecks.
Confirming the NIC Used
- Check the required NIC.
1ifconfig
- Check the NUMA node where the NIC is located, and bind the NIC interrupt ID to the CPU of the NUMA node.
1cat /sys/class/net/XXX/device/numa_node
XXX indicates the network port name. For example, the network port enp125s0f0 is in NUMA node 0.
Binding NIC Interrupts to CPUs
- Disable the irqbalance service.
1 2
service irqbalance status service irqbalance stop

- Query the interrupt ID corresponding to the NIC.
1cat /proc/interrupts | grep enp125s0f0

enp125s0f0 is the network port name.
- Query the CPU bound to the current NIC.
1cat /proc/irq/227/smp_affinity_list
- Manually bind the NIC interrupt ID to a CPU.
For example, bind the NIC interrupt ID to CPU 4.
1echo 4 > /proc/irq/227/smp_affinity_list

You are advised to run the echo 2 > /proc/irq/xxx/smp_affinity_list command to bind the interrupt to the CPU of the NUMA node where the physical NIC is located. In the command, xxx indicates the interrupt ID queried in Step 2. In this example, the interrupt is bound to CPU 2.
Parent topic: Tuning the OS