From: Padraig Brady (padraig.brady at domain corvil.com)
Date: Thu 05 Sep 2002 - 10:18:23 IST
John P. Looney wrote:
> I've a server running a lightly-loaded postgres install.
>
> Though lsof reckons only 1197 filehandles are in use, file-nr says
> differently.
>
> [root at domain jny06 /root]# lsof|wc -l
> 1197
> [root at domain jny06 /root]# cat /proc/sys/fs/file-nr
> 16384 15913 16384
This shows that you allocated max and so ran out at domain some stage.
>
> This upsets me.
>
> Is there any way I can work out how many file handles are in use & be
> sure ? I don't like the idea of just increasing the number of filehandles
> again. I want to know what's using them all.
>
> John
Hmm.. mine is different the other way (lsof lists more than kernel)?
Could this be because of dups? anyway...
[root at domain pixelbeat padraig]# /usr/sbin/lsof | wc -l
4673
[root at domain pixelbeat padraig]# cat /proc/sys/fs/file-nr
2911 1071 52271
and from /usr/src/linux/Documentation/sysctl-fs.txt
file-max & file-nr:
The kernel allocates file handles dynamically, but as yet it
doesn't free them again.
The value in file-max denotes the maximum number of file-
handles that the Linux kernel will allocate. When you get lots
of error messages about running out of file handles, you might
want to increase this limit.
The three values in file-nr denote the number of allocated
file handles, the number of used file handles and the maximum
number of file handles. When the allocated file handles come
close to the maximum, but the number of actually used ones is
far behind, you've encountered a peak in your usage of file
handles and you don't need to increase the maximum.
So summarising:
lsof open = 4673
kernel allocated = 2911
kernel used = 1071
kernel max = 52271 (why this weird high num for standard RH7.3?)
Padraig.
This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:18:40 GMT