---
title: 网卡绑核调整
description: 该场景下可以通过减少网卡队列数并绑定固定核来优化。
url: "https://www.hikunpeng.com/document/detail/zh/kunpengbds/ecosystemEnable/Spark/kunpengspark2xhdpeu_05_0030.html"
---

# 网卡绑核调整

#### 目的

该场景下可以通过减少网卡队列数并绑定固定核来优化。


#### 方法

- 创建一个新的shell脚本，将以下代码复制到其中并执行。
  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


- 创建一个新的shell脚本，将以下代码复制到其中并执行，其中$1是网卡名称。执行后可以实现绑核：
  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
