Linux系统优化
一、最大文件打开数
ulimit -a
ulimit -n 100000
ulimit -u 65535
可通过修改启动文件:
vi /etc/rc.local;
二,调优最大TCP连接数
vim /etc/sysctl.conf
# Increase system IP port limits to allow for more connections
# 调高系统的 IP 以及端口数据限制,从可以接受更多的连接
net.ipv4.ip_local_port_range = 2000 65000
net.ipv4.tcp_window_scaling = 1
# number of packets to keep in backlog before the kernel starts dropping them
# 设置协议栈可以缓存的报文数阀值,超过阀值的报文将被内核丢弃
net.ipv4.tcp_max_syn_backlog = 3240000
# increase socket listen backlog
# 调高 socket 侦听数阀值
net.core.somaxconn = 3240000
net.ipv4.tcp_max_tw_buckets = 1440000
# Increase TCP buffer sizes
# 调大 TCP 存储大小
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216
net.ipv4.tcp_congestion_control = cubic
每次修订配置之后都需要执行以下命令使之生效.
sysctl -p /etc/sysctl.conf