sysctl maxfiles

Gary Palmer gpalmer at freebsd.org
Sat Sep 27 22:18:09 UTC 2008


On Sat, Sep 27, 2008 at 07:05:08PM +1000, Aristedes Maniatis wrote:
> 
> On 27/09/2008, at 1:02 PM, Jeremy Chadwick wrote:
> 
> >Anyway, I'd like to know why you have so many fds open  
> >simultaneously in
> >the first place.  We're talking over 11,000 fds actively open at  
> >once --
> >this is not a small number.  What exactly is this machine doing?  Are
> >you absolutely certain tuning this higher is justified?  Have you  
> >looked
> >into the possibility that you have a program which is exhausting fds  
> >by
> >not closing them when finished?  (Yes, this is quite common; I've seen
> >bad Java code cause this problem on Solaris.)
> 
> 
> Well, there was a runaway process which looks like it is leaking fds.  
> We haven't solved it yet, but the fact that the maxfiles per machine  
> and the maxfiles per process were so close together was really causing  
> us grief for a while.
> 
> 
> 
> >You're asking for trouble setting these values to the equivalent of
> >unlimited.  Instead of asking "what would happen", you should be  
> >asking
> >"why would I need to do that".
> >
> >Regarding memory implications, the Handbook goes over it.
> 
> Unfortunately I've been unable to find it.  While we fix the fd leak  
> I'd like to know how high I can push these numbers and not cause other  
> problems.

At least one port recommends you set

kern.maxfiles="40000"

in /boot/loader.conf.  I think its one of the GNOME ports.  I'm pretty
confident you can run that without too many problems, and maybe go higher,
but if you really want to know the limit its probably kernel memory and
that will depend on your workload.

Solving the fd leak is by far the safest path.  Note that tracking
that many files is probably affecting your application performance
in addition to hurting the system.

Regards,

Gary


More information about the freebsd-stable mailing list