sysctl maxfiles

Aristedes Maniatis ari at ish.com.au
Sat Sep 27 01:10:07 UTC 2008


By default FreeBSD 7.0 shipped with the sysctls set to:

kern.maxfiles: 12328
kern.maxfilesperproc: 11095


We recently bumped up against these limits in an unfortunate way and  
we are going to raise them. I have some questions:

* why are the numbers set the way they are? They aren't round numbers,  
they aren't powers of 2. But they were arrived at somehow with  
planning and thought presumably, so when I increase them I'd like to  
know a bit more about why these numbers were chosen.

* why are the numbers so close together? Surely there should be more  
gap between max files per process and the max files for the whole  
system. What happens is that with one runaway broken process is that  
it hits 11095 and the 1233 files left for everything else is not  
enough (on many servers) to allow the admin to login using ssh. That  
gets very ugly very quickly.

* Under OSX (both server and client), these numbers are 12288 and  
10240. A bit more of a gap, but not terribly different to FreeBSD.  
Still interesting that someone changed these numbers just slightly.

* why do these controls exist at all? That is, if they were set to  
infinite what part of the system would be exhausted by a runaway  
process which kept opening files? Would the kernel run out of memory?  
What memory setting would be relevant here? I don't want to set  
maxfiles too high and then run out of some other resource which this  
maxfiles was protecting.


Thanks
Ari Maniatis





-------------------------->
ish
http://www.ish.com.au
Level 1, 30 Wilson Street Newtown 2042 Australia
phone +61 2 9550 5001   fax +61 2 9550 4001
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A




More information about the freebsd-stable mailing list