---Check the default maximum number of file handles in the system, which is 1024 by default
# ulimit -n
1024
----Check how many handles the current process has opened
# lsof -n|awk '{print $2}'|sort|uniq - c|sort -nr|more
131 24204
57 24244
57 24231 ........
where the first column is the number of open handles and the second is the process ID.
You can view the process name based on the ID number.
# ps aef|grep 24204
nginx 24204 24162 99 16:15 ? 00:24:25 /usr/local/nginx/sbin/nginx -s
Linux has hard and soft limits. These two parameters can be set through ulimit. The method is as follows, run the following command as the root user:
# ulimit -HSn 4096 In
the above commands, H specifies the hard size, S specifies the soft size, and n represents the maximum number of open file handles for a single process. Personally, I think it is best not to exceed 4096. After all, the more the number of open file handles, the slower the response time will definitely be. After setting the number of handles, the default value will be restored after the system restarts. If you want to save it permanently, you can modify the .bash_profile file, you can modify /etc/profile and add the above command to the end.
------------------------- -----------------------
lsof -n|awk '{print $2}'|sort|uniq -c|sort -nr|more
lsof: WARNING: can't stat() ext2 file system /noah/baidulinux/V2-0.0.10-opt/etc/mtab (deleted)
Output information may be incomplete.
lsof: WARNING: can't stat() ext2 file system /noah/baidulinux/V2-0.0.10-opt/etc/nsswitch.conf (deleted)
Output information may be incomplete.
lsof: WARNING: can't stat() ext2 file system /noah/baidulinux/V2-0.0.10-opt/etc/sudoers (deleted)
Output information may be incomplete.
3188 10534
3180 2779
522 1670
434 329
423 689
87 21889
59 16754
16 659
15 32311
11 32315
11 32313
11 32312
10 32317
10 32316
9 32314
number of linux file handles
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=326505739&siteId=291194637
Recommended
Ranking