Rate This Document
Findability
Accuracy
Completeness
Readability

Configuring the VM NIC

When a VM uses the NIC passthrough function, you can adjust the number of NIC queues and binding interrupts to CPUs to achieve optimal network performance and prevent the network from becoming a performance bottleneck.

Adjusting the Number of NIC Queues

  1. Run the following command on the VM to query the number of NIC queues:
    1
    ethtool -l eth1
    

    The preceding information shows that there are 63 queues.

  2. Run the top command to check the CPU usage for processing software interrupts. If the number of queues is insufficient, the CPU usage for processing software interrupts is 100%. In this case, you need to add queues.
  3. Dynamically adjust the number of queues based on the performance. For example, run the following command to change the number of queues to 48:
    1
    ethtool -L eth1 combined 48
    

    More queues do not necessarily mean better performance. You need to observe the CPU usage for processing software interrupts to determine whether a performance bottleneck exists.

Binding NIC Interrupts to CPUs

You are advised to bind interrupts to vCPUs of the NUMA node where the physical NIC resides. You can run the following command on the host to view the NUMA node where the NIC resides:

1
cat /sys/bus/pci/devices/0000\:03\:00.0/numa_node
  1. Disable the irqbalance service on the VM.
    1
    2
    service irqbalance status
    service irqbalance stop
    
  2. Run the following command to query the NIC interrupt ID:
    1
    cat /proc/interrupts | grep eth1
    

    eth1 is the network port name.

  3. Manually bind NIC interrupts to different CPUs.
    1
    echo 2  > /proc/irq/xxx/smp_affinity_list
    

    xxx is the interrupt ID obtained in 2.