linux 大并发测试需要的系统修改

refs:

http://docs.emqtt.cn/zh_CN/latest/getstarted.html

http://www.blogjava.net/yongboy/archive/2013/04/11/397677.html



Linux操作系统参数

# 2M - 系统所有进程可打开的文件数量:

sysctl -w fs.file-max=2097152
sysctl -w fs.nr_open=2097152

# 1M - 系统允许当前进程打开的文件数量:

ulimit -n 1048576

TCP协议栈参数

# backlog - Socket监听队列长度:

sysctl -w net.core.somaxconn=65536

调整 tcp socket参数

   echo "* - nofile 1048576" >> /etc/security/limits.conf
 
     echo "fs.file-max = 1048576" >> /etc/sysctl.conf
     echo "net.ipv4.ip_local_port_range = 1024 65535" >> /etc/sysctl.conf
 
     echo "net.ipv4.tcp_mem = 786432 2097152 3145728" >> /etc/sysctl.conf
     echo "net.ipv4.tcp_rmem = 4096 4096 16777216" >> /etc/sysctl.conf
     echo "net.ipv4.tcp_wmem = 4096 4096 16777216" >> /etc/sysctl.conf

你可能感兴趣的:(linux)