from 'man proc':
/proc/sys/fs/file-max
This file defines a system-wide limit on the number of
open
files for all processes. (See also setrlimit(2),
which can be
used by a process to set the per-process limit,
RLIMIT_NOFILE,
on the number of files it may open.) If you get lots of
error
messages about running out of file handles, try increasing
this
value:
echo 100000 > /proc/sys/fs/file-max
The kernel constant NR_OPEN imposes an upper limit on the
value
that may be placed in file-max.
If you increase /proc/sys/fs/file-max, be sure to
increase
/proc/sys/fs/inode-max to 3-4 times the new value
of
/proc/sys/fs/file-max, or you will run out of inodes.
**/proc/sys/fs/file-nr**
This (read-only) file gives the number of files
presently
opened. It contains three numbers: the number of allocated
file
handles; the number of free file handles; and the maximum
number
of file handles. The kernel allocates file handles
dynamically,
but it doesn't free them again. If the number of
allocated
files is close to the maximum, you should consider
increasing
the maximum. When the number of free file handles is
large,
you've encountered a peak in your usage of file handles and
you
probably don't need to increase the maximum.
The second number is worth looking at to see if the first number is what you need to increase. If so, you can set it in your /etc/sysctl.conf with:
fs.file-max=512000
Note that this sets the system limit; the per-user limit is set with 'ulimit', which you already indicated you were familiar with.