linux优化
1 #!/bin/bash 2 echo "* soft nofile 1048576" >> /etc/security/limits.conf 3 echo "* hard nofile 1048576" >> /etc/security/limits.conf 4 5 echo "fs.file-max = 1048576" >> /etc/sysctl.conf 6 7 echo "net.ipv4.ip_local_port_range = 1024 65535" >> /etc/sysctl.conf 8 echo "net.ipv4.tcp_mem = 786432 2097152 3145728" >> /etc/sysctl.conf 9 echo "net.ipv4.tcp_rmem = 4096 4096 16777216" >> /etc/sysctl.conf 10 echo "net.ipv4.tcp_wmem = 4096 4096 16777216" >> /etc/sysctl.conf 11 12 echo "net.ipv4.tcp_tw_recycle = 1" >> /etc/sysctl.conf 13 echo "net.core.somaxconn = 262144" >> /etc/sysctl.conf 14 echo "net.ipv4.tcp_max_syn_backlog = 8192" >> /etc/sysctl.conf 15 echo "net.core.netdev_max_backlog = 65536" >> /etc/sysctl.conf 16 17 echo "net.ipv4.tcp_keepalive_time = 1800" >> /etc/sysctl.conf 18 echo "net.ipv4.tcp_keepalive_probes = 3" >> /etc/sysctl.conf 19 echo "net.ipv4.tcp_keepalive_intvl = 15" >> /etc/sysctl.conf 20 21 sysctl -p