Nginx: Too program Open Files solution summary, nginxtoo
During Nginx high-pressure testing, sometimes a WEB logs throws Too program Open Files, which is generally optimized from the following three aspects:
1. nginx. conf parameter planning and setting
Worker_rlimit_nofile: Limit the maximum number of files opened by a worker process:
First, check the value settings. Recommended settings: the larger the value, the better.
Second: system-level checks and settings
Is the configuration and modification of/etc/security/limits. conf. Refer to the Linux system resource limit summary.
Third: kernel-level check and settings:
Fs. file-max value size settings:
Note: The default value of file-max is about 10% of the system memory (the system memory is calculated in kb). Do not set it to be smaller than the default value.
After reasonably planning the above three levels of settings, verification must be performed:
1. Verify nginx program restrictions
# Ps-ef | grep nginx
Add the obtained pid xxx to the following:
# Cat/proc/XXX/limits
View the line of Max open files
2. Verify system-level restrictions
# Ulimit-n
3. Verify kernel-level restrictions
# Cat/proc/sys/fs/file-max