Adjusting NIC Interrupt Affinity
Purpose
In this scenario, you can reduce the number of NIC queues and bind their interrupts to specific cores to optimize the performance.
Procedure
- Create a shell script, copy the following code to the script, and execute the script.
1 2 3 4 5 6 7 8
#! /bin/bash ethtool -K enp134s0 gro on ethtool -K enp134s0 tso on ethtool -K enp134s0 gso on ifconfig enp134s0 mtu 9000 up ethtool -G enp134s0 rx 4096 tx 4096 ethtool -G enp134s0 rx 4096 tx 4096 ethtool -L enp134s0 combined 4
- Create a shell script, copy the following code to the script, and execute the script. $1 indicates the NIC name. After execution, NIC interrupt-to-core binding will be applied.
1 2 3 4 5 6 7 8 9
# /bin/bash t=32 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
Parent topic: TeraSort (I/O- + CPU-intensive)