LVS服务器优化记录
调整hash表大小
echo "options ip_vs conn_tab_bits=20" > /etc/modprobe.conf
关闭gro和lro
ethtool -K em1 gro off
ethtool -K em1 lro off
开机后生效
cat /sbin/ifup-local ethtool -K em1 gro off ethtool -K em1 lro off chmod +x /sbin/ifup-local
调整网卡buffer size
ethtool -G em1 rx 2047
nginxUlimit
tail -4 /etc/security/limits.conf * soft nofile 1024000 * hard nofile 1024000 * soft nproc 1024000 * hard nproc 1024000
nginx内核参数
net.ipv4.ip_forward = 0 net.ipv4.conf.default.rp_filter = 1 net.ipv4.conf.default.accept_source_route = 0 kernel.sysrq = 0 kernel.core_uses_pid = 1 kernel.msgmnb = 65536 kernel.msgmax = 65536 kernel.shmmax = 68719476736 kernel.shmall = 4294967296 net.ipv4.ip_local_port_range = 1024 65000 net.ipv4.tcp_max_syn_backlog = 20000 net.core.netdev_max_backlog = 200000 net.core.somaxconn = 20000 net.ipv4.tcp_syncookies = 0 net.ipv4.tcp_syn_retries = 1 net.ipv4.tcp_synack_retries = 2 net.ipv4.tcp_keepalive_time = 600 net.ipv4.tcp_keepalive_probes = 3 net.ipv4.tcp_keepalive_intvl = 15 net.ipv4.tcp_timestamps = 0 net.ipv4.tcp_tw_recycle = 0 net.ipv4.tcp_tw_reuse = 0 net.ipv4.tcp_slow_start_after_idle = 0 net.ipv4.tcp_fin_timeout = 15 net.core.rmem_max = 8388608 net.core.wmem_max = 8388608 net.core.rmem_default = 65536 net.core.wmem_default = 65536 net.ipv4.tcp_rmem = 8192 873800 8388608 net.ipv4.tcp_wmem = 4096 655360 8388608 net.ipv4.tcp_mem = 8388608 8388608 8388608 net.ipv4.tcp_max_tw_buckets = 10000
nginx主配置文件参数修改
worker_rlimit_nofile 250000 worker_connections 250000
浙公网安备 33010602011771号