Ai
1 Star 0 Fork 2

sunlock0653/shell_opt

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
networkbond.sh 1.15 KB
一键复制 编辑 原始数据 按行查看 历史
sunlock0653 提交于 2023-10-27 17:51 +08:00 . 绿网第二天
#!/bin/bash
#脚本中输入yes会进行重启,输入no会进行恢复
##全局变量
#--------------------------------#
yum -y install numactl;
chan=48; #网卡通道数设定
option=$1 #$1为yes则进行重启操作,否则不会重启
cpu_num=`grep -c "processor" /proc/cpuinfo`; #CPU核数
numa_num=`numactl -H|grep cpus|wc -l`
#numa_num=4
per_cpu=$(($cpu_num/$numa_num))
#--------------------------------#
#硬件参数
##网卡调优
#关闭中断均衡
systemctl stop irqbalance.service
systemctl disable irqbalance.service
#改变网卡通道数,ring buffer调为最大,中断聚合参数全设为0
count=0;
for net0 in `ifconfig |grep mtu|awk -F ':' '{print $1}'|grep -v lo|grep -v bond|grep -v vir|sed -n '1,2p'`
do
intid=`ethtool -i $net0|grep bus-info|awk -F ': ' '{print $2}'`
i3=`cat /proc/interrupts | grep $intid|grep mlx5_comp | awk -F ':' '{print $1}'|awk 'NR==1'`
if [ ! -n "$i3" ]; then
i3=`cat /proc/interrupts | grep $net0 | awk -F ':' '{print $1}'|awk 'NR==1'`
fi
echo "int id =$i3"
all=`expr $i3 + $chan`
for((i=$i3; i<all;i++))
do
cpu_id=$(($i-$i3+$per_cpu*$count))
echo $cpu_id > /proc/irq/${i}/smp_affinity_list;
done
for((i=$i3; i<all;i++))
do
cat /proc/irq/${i}/smp_affinity_list;
done
done
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/sunlock0653/shell_opts.git
git@gitee.com:sunlock0653/shell_opts.git
sunlock0653
shell_opts
shell_opt
master

搜索帮助