Nginx: Too program Open Files solution summary, nginxtoo

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.