Too Many open files 问题排查

问题描述:使用netty做性能测试时,并发过大造成Too Many open files问题


该类错误是因为linux系统对socket连接时需要打开的文件句柄数有限制
可以通过ulimit -a 查看

设置句柄数
ulimit -n 10000 [临时设置]
修改 limit.conf文件
sudo vim /etc/security/limits.conf
添加
* soft nofile 10000 [soft 当超过指定数量时告警]
* hard nofile 10000 [hard 真实数值]

查看进程开启的句柄数
lsof -n|awk '{print $2}'|uniq -c|sort -nr

统计指定端口的socket连接数
netstat -ant|grep 'port'|wc -l

猜你喜欢

转载自www.cnblogs.com/htkj/p/10932537.html