Re: too many open files?

Oskar Pearson (oskar@is.co.za)
Mon, 11 Nov 1996 08:38:00 +0200


Hi

> I tried running apache and got back the "too many open files" error.

There are generally two possible errors:
You can have too many files open on your system (say you have lots of programs
that are opening a few files each)
or a single process (like apache) can open 256 files (this is the default
value)

The one you can increase on the fly, the other not.

To increase the total number that you can open on the system, you can
"echo" values to various files in /proc (assuming you are running 2.0.latest)

> How can I check/monitor the number of file descriptors being used??
cat /proc/sys/kernel/file-nr (maximum Overall open files on system opened)
cat /proc/sys/kernel/inode-nr (maximum Overall open inodes on system opened)

cat /proc/sys/kernel/file-max (maximum files on the system that can be opened
concurrently)
cat /proc/sys/kernel/inode-max (maximum inodes on the system that can be opened
concurrently)

> Where do I change it if it needs to be increased?

If you want to increase the files per process, have a look at
http://www.linux.org.za/tweak.html (Yes, I know that it is almost the only
thing on the server :(

If you want to increase the number of maximum open files (ie the value
in file-max is the same as the value in file-nr) you can echo values as
follows:

echo "4096" >/proc/sys/kernel/file-max
echo "12288" >/proc/sys/kernel/inode-max

(inode-max's value is almost allways 3 times the size of file-max, keep it that
way!)

Oskar