#!/bin/sh
chmod +x /etc/rc.d/rc.local
#1、修改grub,设置cpu隔离和1G大页
#isolcpus=1-55 transparent_hugepage=never default_hugepagesz=1G hugepagesz=1G hugepages=16
#2、关闭numa_balancing和watchdog
echo 0 > /proc/sys/kernel/numa_balancing
echo 0 > /proc/sys/kernel/watchdog
#3、打开文件句柄数调整,默认的4096可能不够
#ulimit -n 65536
#4、CPU打开性能模式
cpupower frequency-set -g performance
#5、网卡中断绑定到系统核上
for irq in `cat /proc/interrupts |egrep -i -e "-(rx|tx|txrx)-" | cut -d: -f1 | sed "s/ //g"`;
do
echo "reset /proc/irq/$irq/smp_affinity"
echo 1 > /proc/irq/$irq/smp_affinity;
done
#6、设置timewait重用
sysctl net.ipv4.tcp_tw_recycle=1
sysctl net.ipv4.tcp_tw_reuse=1
#去掉cpu100%的告警
sysctl -w kernel.watchdog=0
#8、关闭其他的服务
systemctl disable irqbalance
systemctl stop irqbalance
systemctl disable firewalld.service
systemctl stop firewalld.service
#9、打开必要服务
#systemctl enable vsftpd
#关闭图形界面
systemctl set-default runlevel3.target
tuned-adm profile latency-performance