emqtt 系统方面参数调优 —————————————- (一)执行如下命令 echo 2097152 > /proc/sys/fs/nr_open ulimit -n 1048576 (二)编辑 /etc/sysctl.conf ,加入如下项 fs.file-max=2097152 注:这个参数控制能连接多少个客户端 fs.nr_open=2097152 net.core.somaxconn=65536 net.ipv4.tcp_max_syn_backlog=16384 net.core.netdev_max_backlog=16384 net.ipv4.ip_local_port_range=1000 65535 net.core.rmem_default=262144 net.core.wmem_default=262144 net.core.rmem_max=16777216 net.core.wmem_max=16777216 net.core.optmem_max=16777216 #net.ipv4.tcp_mem=16777216 16777216 16777216 net.ipv4.tcp_rmem=1024 4096 16777216 net.ipv4.tcp_wmem=1024 4096 16777216 net.nf_conntrack_max=1000000 net.netfilter.nf_conntrack_max=1000000 net.netfilter.nf_conntrack_tcp_timeout_time_wait=30 net.ipv4.tcp_max_tw_buckets=1048576 net.ipv4.tcp_fin_timeout = 15
#然后执行 sysctl -p 生效
(三)编辑 /etc/security/limits.conf文件
/etc/security/limits.conf持久化设置允许用户/进程打开文件句柄数:
- soft nofile 1048576
- hard nofile 1048576