1、單程序句柄數限制
查看配置的句柄數:ulimit -n
cat /etc/security/limits.conf
參考配置:
* soft nofile 655360
* hard nofile 655360
2、全局句柄數限制
cat /proc/sys/fs/file-max
參考配置:
6815744
3、分析句柄數常用命令
(1)統計各進程打開句柄數:lsof -n|awk '{print $2}'|sort|uniq -c|sort -nr
(2)統計各用戶打開句柄數:lsof -n|awk '{print $4}'|sort|uniq -c|sort -nr
(3)統計各命令打開句柄數:lsof -n|awk '{print $1}'|sort|uniq -c|sort -nr