CentOS6.4 内核优化
vi /etc/sysctl.conf
net.ipv4.tcp_syncookies = 1 net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_tw_recycle = 1 net.ipv4.ip_local_port_range = 1024 65000 net.ipv4.tcp_max_syn_backlog = 8192 net.ipv4.tcp_max_tw_buckets = 5000 net.ipv4.tcp_max_syn_backlog = 65536 net.core.netdev_max_backlog = 32768 net.core.somaxconn = 32768 net.core.wmem_default = 8388608 net.core.rmem_default = 8388608 net.core.rmem_max = 16777216 net.core.wmem_max = 16777216 net.ipv4.tcp_timestamps = 0 net.ipv4.tcp_synack_retries = 2 net.ipv4.tcp_syn_retries = 2 net.ipv4.tcp_mem = 94500000 915000000 927000000 net.ipv4.tcp_max_orphans = 3276800 kernel.sysrq = 0 kernel.core_uses_pid = 1 kernel.msgmnb = 65536 kernel.msgmax = 65536 kernel.shmmax = 68719476736 kernel.shmall = 4294967296 vm.swappiness=10 vm.max_map_count=262144
这些配置来自大侠 抚琴煮酒
让改动配置立即生效
/sbin/sysctl -p
修改limits.conf
vi /etc/security/limits.conf
* soft nproc 65536 * hard nproc 65536 * soft nofile 65536 * hard nofile 65536
修改90-nproc.conf
vi /etc/security/limits.d/90-nproc.conf
* soft nproc 65536
记得重启服务器