1. /proc/sys/fs/file-nr
1.1. 理解分析
[root@localhost ~]# cat /proc/sys/fs/file-nr
7456 0 6583463
这个文件是一个只读文件,不能进行修改,应为它是当前系统文件句柄使用的一个概况。这里的最大值是/proc/sys/fs/file-max
中设置的,具体设置值可以查看【/proc/sys/fs/file-max】文章。
但在kernel 2.6版本中第二项的值总为0,这并不是一个错误,它实际上意味着已经分配的文件句柄无一浪费的都已经被使用了。如果有值说明以前遇到过使用句柄的峰值了,现在用不了那么多的句柄就会有空闲句柄,句柄分配后系统不会回收。
1.2. 配置设置
只读文件,不可修改
1.3. 中文翻译
这个文件(只读)获取当前打开的文件数量。它包含三个数字: 1.已经分配的文件句柄数, 2.已经分配但没有使用的文件句柄数, 3.最大文件句柄数。 内核动态分配文件句柄,但是不会再次释放他们。如果已经分配的文件值接近最大值时,你应该考虑增大这个最大值。如果空闲文件句柄很大,那么你可能遇到了一个文件句柄使用峰值,你不需要增大这个最大值。
This (read-only) file gives the number of files presently opened. It contains three numbers: the number of allocated file handles; the number of free file handles; and the maximum number of file handles. The kernel allocates file handles dynamically, but it doesn't free them again. If the number of allocated files is close to the maximum, you should consider increasing the maximum. When the number of free file handles is large, you've encountered a peak in your usage of file handles and you probably don't need to increase the maximum.