# man 5 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-max配置总个系统(所有进程)的资源限制,setrlimit()配置单个进程的资源限制。
/proc/sys/fs/inode-max应该设置为/proc/sys/fs/file-max的3~4倍