ulimit shows the per-process maximum. The two files under
/proc shows system-wide numbers.
file-max is the maximum File Descriptors (FD) enforced on a kernel level, which cannot be surpassed by all processes without increasing. The
ulimit is enforced on a process level, which can be less than the
What is the
file-max parameter and what should we tune it to? The linux documentation definition is that
file-max denotes the maximum number of filehandles that the Linux kernel will allocate.
How do I know if I’m getting close to hitting this limit on my server? Run the command:
cat /proc/sys/fs/file-nr. This will return three values, denote the number of allocated file handles, the number of allocated but unused file handles, and the maximum number of file handles. Note that
file-nr IS NOT a tunable parameter. It is informational only. On my server, this returns:
3488 0 793759. This means that currently, my server has only allocated 3488 of the 793,759 allocation limit and is in no danger of hitting this limit at this time.