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?
I think this is what you are looking for.
|All times are GMT -5. The time now is 02:55 AM.|