Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Sep 2002 16:48:48 -0500
From:      Dan Nelson <dnelson@allantgroup.com>
To:        Soheil Shaghaghi <soheils@jhanna.com>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: Open files limit
Message-ID:  <20020912214846.GE42486@dan.emsphone.com>
In-Reply-To: <JGEPKJHDAHAGGDLNIEDEOEIIDFAB.soheils@jhanna.com>
References:  <20020912183244.5C46137B401@hub.freebsd.org> <JGEPKJHDAHAGGDLNIEDEOEIIDFAB.soheils@jhanna.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Sep 12), Soheil Shaghaghi said:
> Hello everyone,
> I am running a FreeBSD 4.6 server
> I get a lot of too many open files in the system.
> Searching the net, I found the reason.
> Looking at the limits, here is what I get:
> ulimit -a
> open files                  1064
> 
> Question:
>
> 1. I know that the number of open files should be increased, but I
> don't know to what number! Can I set it to unlimited? Is there a
> problem with doing this? I am running about 100 virtual hosts and a
> Java chat server and a music server on this machine.

You can't set it to unlimited, since there is a file table in the
kernel and it has a size.  Luckily it is dynamically adjustable.

> 2. Can anyone recommend a different settings than the above, so I can
> change it all at once?
> 
> 3. The documents say to change the value and recompile the kernel. Do
> I have to specify the new values in the kernel, and if so how?

You don't even have to reboot.  Run "sysctl kern.maxfiles" to print the
current value, then double (or triple) it, and run "sysctl -w
kern.maxfiles=####".  You can put a line like "kern.maxfiles=####" in
/etc/sysctl.conf to have the change made on every reboot.  You may also
have to edit /etc/login.conf and adjust any "openfiles=####" lines that
might be lowering the per-process limit.

-- 
	Dan Nelson
	dnelson@allantgroup.com

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020912214846.GE42486>