开发者社区> 问答> 正文

linux怎么优化Linux内核参数的操作呢?

linux怎么优化Linux内核参数的操作呢?

展开
收起
游客yzrzs5mf6j7yy 2021-12-06 09:52:20 368 0
1 条回答
写回答
取消 提交回答
  •   cp /etc/sysctl.conf /etc/sysctl.confbak   vi /etc/sysctl.conf #在文件末尾添加以下内容

      net.ipv4.ip_forward = 1 #修改为1

      net.core.somaxconn = 262144

      net.core.netdev_max_backlog = 262144

      net.core.wmem_default = 8388608

      net.core.rmem_default = 8388608

      net.core.rmem_max = 16777216

      net.core.wmem_max = 16777216

      net.ipv4.netfilter.ip_conntrack_max = 131072

      net.ipv4.netfilter.ip_conntrack_tcp_timeout_established = 180

      net.ipv4.route.gc_timeout = 20

      net.ipv4.ip_conntrack_max = 819200

      net.ipv4.ip_local_port_range = 10024 65535

      net.ipv4.tcp_retries2 = 5

      net.ipv4.tcp_fin_timeout = 30

      net.ipv4.tcp_syn_retries = 1

      net.ipv4.tcp_synack_retries = 1

      net.ipv4.tcp_timestamps = 0

      net.ipv4.tcp_tw_recycle = 1

      net.ipv4.tcp_tw_len = 1

      net.ipv4.tcp_tw_reuse = 1

      net.ipv4.tcp_keepalive_time = 120

      net.ipv4.tcp_keepalive_probes = 3

      net.ipv4.tcp_keepalive_intvl = 15

      net.ipv4.tcp_max_tw_buckets = 36000

      net.ipv4.tcp_max_orphans = 3276800

      net.ipv4.tcp_max_syn_backlog = 262144

      net.ipv4.tcp_wmem = 8192 131072 16777216

      net.ipv4.tcp_rmem = 32768 131072 16777216

      net.ipv4.tcp_mem = 94500000 915000000 927000000

      /sbin/sysctl -p #使配置立即生效

    2021-12-06 09:52:31
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
Alibaba Cloud Linux 3 发布 立即下载
ECS系统指南之Linux系统诊断 立即下载
ECS运维指南 之 Linux系统诊断 立即下载