侧边栏壁纸
博主头像
CYC的个人博客博主等级

学习使人进步

  • 累计撰写 91 篇文章
  • 累计创建 11 个标签
  • 累计收到 1 条评论

目 录CONTENT

文章目录

Linux内核优化

Administrator
2023-11-15 / 0 评论 / 0 点赞 / 94 阅读 / 1231 字

Linux内核优化

#永久生效修改
/etc/security/limits.conf

#查询文件最大打开数
/proc/sys/fs/file-max

cat  /proc/sys/fs/file-max

cat /proc/sys/fs/file-nr


#修改/etc/sysctl.conf
vim /etc/systctl.conf


#虚拟内存利用率可根据实际情况调整
vm.swappiness = 30

#文件最大打开数量
fs.file-max = 300000

net.ipv4.neigh.default.gc_stale_time=120
net.ipv4.tcp_keepalive_time = 1200

# see details in https://help.aliyun.com/knowledge_detail/39428.html
net.ipv4.conf.all.rp_filter=0
net.ipv4.conf.default.rp_filter=0
net.ipv4.conf.default.arp_announce = 2
net.ipv4.conf.lo.arp_announce=2
net.ipv4.conf.all.arp_announce=2

# see details in https://help.aliyun.com/knowledge_detail/41334.html
net.ipv4.tcp_max_tw_buckets = 8092
net.ipv4.tcp_syncookies = 1
#全连接队列大小
net.core.somaxconn = 65500
net.core.netdev_max_backlog = 220000 
#半连接队列大小
net.ipv4.tcp_max_syn_backlog = 220000 
net.ipv4.tcp_synack_retries = 2
net.ipv4.ip_local_port_range=19000 65500


#解决大量timewait
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_timestamps = 1
#外网不能采用不能将值设置成1会导致大量会话丢失
net.ipv4.tcp_tw_recycle = 0
net.ipv4.tcp_fin_timeout = 10


net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1


kernel.sysrq=1






0

评论区