单机百万并发链接需要修改的一些系统参数备忘

1.Too Many Files
默认1024
echo ulimit -n 65535 >>/etc/profile

2.Address already in use
/etc/security/limits.conf
每个进程打开的io数量
root hard nofile 1048576
root soft nofile 1048576

/etc/sysctl.conf

net.ipv4.tcp_mem = 252144 524288 7786432
net.ipv4.tcp_wmem = 1024 1024 2048
net.ipv4.tcp_rmem = 1024 1024 2048
文件系统
fs.file-max = 1048576
tcp链接的网络数量
net.nf_conntrack_max = 1048576
net.netfilter.nf_conntrack_tcp_timeout_established = 1200

你可能感兴趣的:(学习历程)