Operating System - HP-UX
1829596 Members
1990 Online
109992 Solutions
New Discussion

see how many open files (maxfiles)

 
plumanv
New Member

see how many open files (maxfiles)

Is there a tool / a way to see how much and which open files really are in use ? I already searched the knowledge base but came up with nothing usefull. I found out ulimit -aS en ulimit -aH, but that only shows the parameter setting.

I'd like to monitor the real number of open files in order to be able to set a decent value for my maxfiles and maxfiles_lim parameters.

Thanks in advance
Bart
5 REPLIES 5
Pete Randall
Outstanding Contributor
Arunvijai_4
Honored Contributor

Re: see how many open files (maxfiles)

lsof is the tool,
http://hpux.connect.org.uk/hppd/hpux/Sysadmin/lsof-4.76/
http://hpux.connect.org.uk/hppd/hpux/Sysadmin/lsof-4.76/man.html

For using lsof, check this thread

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=666769

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Vibhor Kumar Agarwal
Esteemed Contributor

Re: see how many open files (maxfiles)

Yes,

lsof combined with fuser will give you the perfect result.
Vibhor Kumar Agarwal
Muthukumar_5
Honored Contributor

Re: see how many open files (maxfiles)

You can see open files basically with,

sar -v 1,2


To see specifically then get lsof tool to monitor it.

hth.
Easy to suggest when don't know about the problem!
Bill Hassell
Honored Contributor

Re: see how many open files (maxfiles)

sar -v 1 will show you all open files for all processes, not a specific process. lsof will show you all the files opened by a single process. maxfiles(_lim) apply to a single process and are used to limit runaway processes from using all the file descriptors in the system. Your programmer, DBA or application supplier can tell you the maximum number of open files needed by various programs. You can also just set the value to a large number, perhaps 200 for most programs, and 2000 for maxfiles_lim. Any program that needs more than a few hundred files open at the same time will be smart enough to call setrlim to adjust the maxfiles value internally. If not, point out the man page for setrlim to your programmer.

It is common for a vendor to state: maxfiles=maxfiles_lim=2000 which defeats the purpose of maxfiles. maxfiles is designed to limit casual programs. After all, why is a program opening so many files in the first place? Now if you don't have a programmer, you can still leave maxfiles=200 and change the maxfiles value for a specific program (same as setrlim) with:

ulimit -Sn 2000

Put this into a startup script and this specific program will now have maxfiles set to 2000. This is the preferred way to handle programs that need massive numbers of files open at the same time.


Bill Hassell, sysadmin