Use the/proc file system to control the system
/Proc/sys/fs
/Proc/sys/fs/file-max
This file specifies the maximum number of file handles that can be allocated. If you get an error message stating that the number of opened files has reached the maximum value, so that they cannot open more files, you may need to increase the value. You can set this value to any number of files and change it by writing a new numeric value to the file.
Default: 4096
/Proc/sys/fs/file-NR
This file is related to file-Max. It has three values:
Number of allocated file handles
Number of file handles used
Maximum number of file handles
This file is read-only and only used to display information.
Therefore, there is no issue of simultaneous modification of two files. You can only modify file-max.
3. ulimit-
Open File (-N) 1024
That is, ulimit-n
-N the maximum number of open file descriptors (most systems
Do not allow this value to be set)
Ulimit-n <number of files that can be opened at the same time> sets the maximum number of files that can be opened at the same time (max open files)
Example: ulimit-N 8192
If this parameter is set too small, the too program open files error may occur for websites with a large number of concurrent visits.