初装Linux网络优化


Linux系统初装后TCP memory默认参数配置为128K,在过多进程负载网络通信的情况下就会出现异常。

可以使用命令扩大使用内存:
#sysctl -w net.core.rmem_max=16777216
#sysctl -w net.core.wmem_max=16777216
##修改为16M

最好同时修改 /etc/sysctl.conf文件,保证系统正常运行:

# These ensure that TIME_WAIT ports either get reused or closed fast.
net.ipv4.tcp_fin_timeout = 1
net.ipv4.tcp_tw_recycle = 1
# TCP memory
net.core.rmem_max = 16777216
net.core.rmem_default = 16777216
net.core.netdev_max_backlog = 262144
net.core.somaxconn = 262144

相关内容