LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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


Reply
  Search this Thread
Old 09-03-2011, 12:09 PM   #1
herthh
LQ Newbie
 
Registered: Dec 2010
Posts: 2

Rep: Reputation: 0
Getting nr of open file descriptors in processes without loop over fd-directory.


Web search brought no direct hint if we can get the number of open file descriptors in a process without lopping over the content of /proc/#fd, what is a comparatively slow operation. The problem appeared so imminent to me when we attempted to collect performance metrics of a node under heavy load, say 1500-2000 processes, with open fd's counting 10,000 to 20,000.

We loop open /proc, go to each process sub directory, a pretty std stuff using readdir() etc. Generic in Linux, but CPU (kernel time) very expensive because the content of files like 'stat' is in ascii.

And even that's not all: No open FD value can be found! In order to get to it, inside of every process directory we are forced to open the fd subdirectory and lopp inside it again to get one lousy value!

So I am asking the Linux kernel or file-system gurus: Can we get that value without the loop, like read the dir internal descriptor, or even directly something in the process itself?
 
Old 09-04-2011, 12:55 PM   #2
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
I think this is what you are looking for.
 
  


Reply

Tags
directly, files, kernel, performance



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how kernel resolves file descriptors when you do open() or read() alankar Linux - Kernel 2 09-04-2009 12:35 AM
Max open file descriptors stuck at 1024? ravindra.j21 Linux - Newbie 1 06-12-2009 05:03 AM
POSIX-portable (i.e. glibc) way to list all open file descriptors? ta0kira Programming 2 07-22-2007 01:09 PM
Geting error loop QFike:getch: File not open QFile:atEnd: this file is not open badgerbox76 Linux - Newbie 6 01-07-2006 05:30 PM
How to find out the number of open file descriptors? skie_knite007 Programming 2 12-11-2005 10:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:05 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration