Operating System - HP-UX
1822158 Members
4139 Online
109640 Solutions
New Discussion юеВ

Maximum number of file descriptors per process?

 
SOLVED
Go to solution
Andrew Caballes
Occasional Contributor

Maximum number of file descriptors per process?

Hello all!

Is there a way to increase the maximum number of open file descriptor limit
in HPUX 11.0? On a related note, how high can this number be adjusted?

I've got a HP 9000 700 series machine with 1Gbyte of RAM.

Thanks!
12 REPLIES 12
Andy Monks
Honored Contributor
Solution

Re: Maximum number of file descriptors per process?

There are 2 parameters.

maxfiles and maxfiles_lim

The defaults are 60 and 1024 and the max is 2048 for both.
Vladislav Demidov
Honored Contributor

Re: Maximum number of file descriptors per process?

Don't forget about nfile(maximum file descriptors per system) parameter too....
CHRIS_ANORUO
Honored Contributor

Re: Maximum number of file descriptors per process?

Run sysdef to know the limits.
When We Seek To Discover The Best In Others, We Somehow Bring Out The Best In Ourselves.
Andrew Caballes
Occasional Contributor

Re: Maximum number of file descriptors per process?

Thanks!

Another related question:
Can this number be bumped up to around
10,000 file descriptors per process?
Vladislav Demidov
Honored Contributor

Re: Maximum number of file descriptors per process?

You cann't increase this parameter up to 10,000 per one process. you have to rewrite you application to use 5 processes.
Andy Monks
Honored Contributor

Re: Maximum number of file descriptors per process?

as the limit is 2048, then the answer is no!. Why would any application need to have 10,000 files open at the same time?
Rita C Workman
Honored Contributor

Re: Maximum number of file descriptors per process?

Increasing the 'nfile' parameter will increase the number of files that can be opened. Increasing 'nproc' parameter will increase the number of open processes. Both of these can be modified in SAM via /kernel/configurable parameters.
Once you change nproc you will notice that it will change (as needed) other parameters to account for the adjustment.
Andy Monks
Honored Contributor

Re: Maximum number of file descriptors per process?

Andrew, maxfiles/maxfiles_lim are per-process limits. nfile is a system wide limit. nfile is limited by physical memory.
Vladislav Demidov
Honored Contributor

Re: Maximum number of file descriptors per process?

Andy, nfile parameters should be bigger then 2048 or seral times 2048 otherwise several processes will not be able to seize 2048 file descriptors each.
Bill Hassell
Honored Contributor

Re: Maximum number of file descriptors per process?

The 2048 value is a hard limit in the kernel (maxfiles_lim). WHile a program can change the maxfiles value with a call to setrlimit(2), it cannot be increased beyond 2048.

Also, the default POSIX shell offers ulimit as a user interface to several 'soft' parameters such as maxfiles, core file limit, memory usage, processor time, etc. ulimit -a will listt the values that can changed. Once changed, all child proceses inherit the shell settings.

As an aside, one has to question the need to open 10,000 files at the same time. Even the Universe database program (which can use thousands of unique files) uses a file descriptor pool to limit simultaneous open files to a few hundred. As mentioned in a previous reply, if 20 copies of the same program were to open 10,000 files (the same 10,000 files), you would need nfile set to 200,000, a huge number indeed.


Bill Hassell, sysadmin
Andrew Caballes
Occasional Contributor

Re: Maximum number of file descriptors per process?

Thank you all for your responses, they have been very helpful.

As for the 10,000 file descriptors, I was hoping to be able to
open that number of sockets, not files per se.

Again, my thanks.
Miguel Angel Ortega
New Member

Re: Maximum number of file descriptors per process?

The answer for your question is this:
edit the file containig the limits for kernel parameters:

vi /usr/conf/master.d/core-hpux

search the maxfiles and maxfiles_lim and modify the
range values (minimum , maximum) according to your
needs, then save file and make sam to recognize them
executing:

/usr/sam/lbin/getkinfo -b

Now the maximum and minimun range for the parameter
is set, and you can modify maxfile and maxfiles_lim
up to 10000 or whatever.
You can have your application runnig with many sockets
as you need.




mortega