标签:cookie for 结果 bucket syn color soft sysctl trie
默认情况下,linux系统有一些限制,并不能直接支持高并发性能,需要做一些内核优化。
1 net.ipv4.ip_forward=1 2 net.ipv4.tcp_syncookies = 1 3 net.ipv4.tcp_tw_reuse = 1 4 net.ipv4.tcp_tw_recycle = 1 5 net.ipv4.tcp_fin_timeout = 30 6 net.ipv4.tcp_keepalive_time = 1200 7 net.ipv4.ip_local_port_range = 10000 65000 8 net.ipv4.tcp_max_syn_backlog = 8192 9 net.ipv4.tcp_max_tw_buckets = 5000 10 net.ipv4.tcp_max_syn_backlog = 65536 11 net.core.netdev_max_backlog = 32768 12 net.core.somaxconn = 32768 13 net.core.wmem_default = 8388608 14 net.core.rmem_default = 8388608 15 net.core.rmem_max = 16777216 16 net.core.wmem_max = 16777216 17 net.ipv4.tcp_synack_retries = 2 18 net.ipv4.tcp_syn_retries = 2 19 net.ipv4.tcp_tw_reuse = 1 20 net.ipv4.tcp_wmem = 8192 436600 873200 21 net.ipv4.tcp_rmem = 32768 436600 873200 22 net.ipv4.tcp_mem = 94500000 91500000 92700000 23 net.ipv4.tcp_max_orphans = 3276800 24 net.ipv4.tcp_fin_timeout = 30 25 vm.overcommit_memory = 1
执行
1 sysctl -p
加入以下内容至末尾
1 * soft nproc 40000 2 * hard nproc 40000 3 * soft nofile 40000 4 * hard nofile 40000
加入以下内容至末尾
1 session required /lib64/security/pam_limits.so 2 session required pam_limits.so
加入以下指令到末尾
1 ulimit -n 65535
重启一下系统,执行 ulimit -a 可以看到优化结果,执行 ulimit -n 可以看到最大连接数限制,默认是1024
1 ulimit -a
标签:cookie for 结果 bucket syn color soft sysctl trie
原文地址:https://www.cnblogs.com/travis-li/p/12598799.html