内核参数调优
[root@localhost ~]# cat >> /etc/sysctl.conf << EOF
net.core.rmem_default = 129024
net.core.rmem_max = 16777216
net.core.wmem_default = 262144
net.core.wmem_max = 16777216
net.core.somaxconn = 1024
net.core.netdev_max_backlog = 262144
net.ipv4.tcp_max_orphans = 262144
net.ipv4.tcp_max_syn_backlog = 262144
net.ipv4.tcp_max_tw_buckets = 10000
net.ipv4.ip_local_port_range = 1024 65500
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_synack_retries = 1
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.tcp_mem = 786432 1048576 1572864
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
fs.inotify.max_user_watches = 1048576
EOF
该参数定义了共享内存段的最大尺寸以字节为单位
kernel.shmmax = 68719476736
内核日志等级
kernel.printk = 5
关闭 ipv6
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
脏数据的处理,根据场景不同进行设置
如果是数据库服务器,可降低内存缓存比例
vm.dirty_background_ratio = 5
vm.dirty_ratio = 10
如果是业务服务器,可加大内存缓存比例
vm.dirty_background_ratio = 50
vm.dirty_ratio = 80
[root@localhost ~]# sysctl -p