Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
05-01-2003, 11:30 AM
|
#1
|
Senior Member
Registered: May 2001
Location: Bristol, UK
Distribution: Slackware, Fedora, RHES
Posts: 2,243
Rep:
|
/proc/sys/fs/file-nr ??
Anyone got any good resources on what this file really shows? I've got a server that runs out of file handles but whats reported by file-nr doesn't make sense - Observe
Code:
[root@cuboid root]# cat /proc/sys/fs/file-nr
2713 1166 235928
So according to the info I've found so far... 2713 = allocated file handles, 1166 = available file handles, 235928 = max file handles (as set in /proc/sys/fs/file-max). I know that some documentation (including the kernel docs!) say that the 1166 = handles used but this isn't the case as every file I open a new file this number goes down.
First question - Why doesn't available_files = max_files - allocated_files ??
And why is the output from
Code:
[root@cuboid root]# lsof | wc -l
27128
so very very different to allocated files?
Any info greatly appreciated!
Jamie...
|
|
|
05-02-2003, 08:52 AM
|
#2
|
Senior Member
Registered: Dec 2001
Location: The Netherlands
Distribution: Ubuntu
Posts: 1,316
Rep:
|
Well from what I can see is that the second number is the amount of allocated handles which are available. Not the total amount of available handles.
If I test it with an application that keeps allocating filehandles. I can see that the second number decreases till it gets to something really low like 10, the first number stays constant while this happens. After it reaches a low point then the first number starts increasing and the second number stays low. Ofcourse the first number won't go any higher then the max.
I don't really know why lsof would show so many more lines. Unless you are running a lot of multithreading applications and it's showing multiple entries for the same file descriptors.
Well that's as much information as I could think of without going through the kernel code and find out what is really going on, which I don't really feel like doing.
|
|
|
05-02-2003, 09:03 AM
|
#3
|
Senior Member
Registered: May 2001
Location: Bristol, UK
Distribution: Slackware, Fedora, RHES
Posts: 2,243
Original Poster
Rep:
|
Quote:
Originally posted by Mik
Well from what I can see is that the second number is the amount of allocated handles which are available. Not the total amount of available handles.
|
Excuse my density on the subject... Whats the distinction between available allocated handles and the total available handles??
Quote:
Originally posted by Mik
If I test it with an application that keeps allocating filehandles. I can see that the second number decreases till it gets to something really low like 10, the first number stays constant while this happens. After it reaches a low point then the first number starts increasing and the second number stays low.
|
So as you open files you use the allocated files handles (middle number gets lower), when this number moves towards some threshold more file handles are made available for processes to use (the first number gets larger) yeah? If this is the case why doesn't the available allocated handles suddenly increase? Or have I misunderstood something (very likely).
Quote:
Originally posted by Mik
Well that's as much information as I could think of without going through the kernel code and find out what is really going on, which I don't really feel like doing.
|
Exactly how I feel about the problem. Not being a C coder it would be a challenge to say the least!
Thanks for the info so far its a great help.
Jamie...
|
|
|
05-02-2003, 09:24 AM
|
#4
|
Senior Member
Registered: Dec 2001
Location: The Netherlands
Distribution: Ubuntu
Posts: 1,316
Rep:
|
Well I'm not an expert on the topic but I was just trying to show what conclusions I came up with. I'll try to explain my conclusions using example to make it more clear. This system I was trying things out on only has the max set to double the default:
#cat /proc/sys/fs/file-nr
2788 1270 8192
Now according to what I see 8192 is the maximum. 2788 is the amount allocated and 1270 is the amount of unused. Meaning that there would be 2788 - 1270 being used. Instead of 8192 -1270 being used. That's what I meant with the difference between 'available allocated handles' and 'total available handles'.
If I start an example application like bash. After starting bash once only the middle number will have decreased by 20. 'lsof | wc -l' increases by 26. The amount changed stays the same each time I start a new bash process. This stays the same till the middle number gets really low. Then it starts allocating new filehandles and the first number starts increasing by 20 instead.
I guess lsof reports more then just the open files for each process. Since it contains 6 lines more each time.
This is just what I see happening. So your conclusion out of that is as good as mine.
|
|
|
05-02-2003, 10:01 AM
|
#5
|
Senior Member
Registered: May 2001
Location: Bristol, UK
Distribution: Slackware, Fedora, RHES
Posts: 2,243
Original Poster
Rep:
|
SORTED!
Now I get it!
cheers mate
Jamie...
|
|
|
07-27-2009, 07:07 PM
|
#6
|
Member
Registered: Jul 2003
Location: Oahu, Hawaii, USA
Distribution: Ubuntu, Debian, RHES
Posts: 57
Rep:
|
I know I'm doing serious necro posting, but as a Google search for file-nr shows this second on the results, I thought it would be worth posting the link to this useful description I found:
http://www.netadmintools.com/part295.html
|
|
|
All times are GMT -5. The time now is 02:23 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|