Error: too many open files processing

Preface
When doing stress testing, you may often report errors: too many open files,
so we have two ways to modify: temporary modification and permanent modification.
The default number of open files in linux is 1024, which can be viewed through ulimit -a open files

experimental environment
LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64: printing-4.0-noarch
Distributor ID: CentOS
Description: CentOS release 6.7 (Final)
Release: 6.7
Codename: Final
Temporary modification Modification of this limit can be permanently modified
using ulimit -SHn 65536 1. /etc/pam.d/login add pam_limits.so (Sometimes the system is added by default, and the absolute path of so can also be written) session required pam_limits.so 2. /etc/security/limits.conf Add * soft nofile 65536 * hard nofile 65536








The syntax is as follows: www - nofile 1006154
www is a user, if you want all users to take effect, replace it with *. The value set is related to the hardware configuration, so don't set it too much.

3. Modify /etc/rc.local to add
echo 8061540 > /proc/sys/fs/file-max
(the data here is adjusted according to your actual needs)
The actual problem solved by this method is: under high load squid, mysql will It occurs that the number of open files exceeds the system's process limit, causing a system bottleneck.

Note
that the hard limit in this is the actual limit.
The soft limit, which is the warning limit, will only make a warning.
In fact, the ulimit command itself has soft and hard settings, plus -H is hard, plus -S is soft.
The default display is the soft limit. If it is not added when running the ulimit command to modify it, the two parameters are changed together.

The difference between linux file descriptors open file descriptors and open files
refer to article
http://blog.itpub.net/15480802/viewspace-734062/

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327015871&siteId=291194637