Rate This Document
Findability
Accuracy
Completeness
Readability

Binding NIC Interrupts to Cores

Purpose

Compared with using the kernel's irqbalance to schedule NIC interrupts across all cores, manually binding interrupts to cores can effectively improve the service network throughput.

Procedure

  1. Disable irqbalance.

    Before binding NIC interrupts to cores, disable irqbalance.

    1. Stop the irqbalance service. The service will be invalid after the system restarts.
      1
      systemctl stop irqbalance.service
      
    2. Disable the irqbalance service. This setting is permanently valid.
      1
      systemctl disable irqbalance.service
      
    3. Check whether the irqbalance service is disabled.
      1
      systemctl status irqbalance.service
      
  2. Check the PCI device number of the NIC. Assume that the current NIC name is enp131s0.
    1
    ethtool -i enp131s0
    

  3. Check the NUMA node to which the PCIe NIC connects.
    1
    lspci -vvvs <bus-info>
    

  4. Check the cores corresponding to the NUMA node.
    1
    numactl -H
    

    Assume that the four NIC queues are located on the NUMA node 1. Bind the four NIC queues to the last four CPU cores 60 to 63 on the NUMA node 1.

  5. Create a shell script and copy the following code to the script for core binding. $1 indicates the NIC name, that is, enp131s0.
    1
    2
    3
    4
    5
    6
    7
    8
    9
    # /bin/bash
    t=60
    for i in `cat /proc/interrupts |grep -e $1 |awk -F ':' '{print $1}'`
    do
    cat /proc/irq/$i/smp_affinity_list
    echo $t > /proc/irq/$i/smp_affinity_list
    cat /proc/irq/$i/smp_affinity_list
    t=`expr $t + 1`
    done