Number of Nginx worker processes

Source: Internet
Author: User

There is a worker_processes configuration item in the nginx.conf configuration file, which is configured by default:

Worker_processes 1

The number of worker processes directly affects performance.
Each worker process is a single-threaded process that invokes each module to implement a variety of functions, and if the modules confirm that there are no blocking calls, how many worker processes are configured for the number of CPU cores, and if there is a possibility of blocking calls, A little more worker processes are required.
For example:
If the business needs to read a lot of static files on the disk, and the memory on the server is small enough that most requests to access the static file must read the disk rather than the in-memory disk cache, the disk I/O call may block the worker process for a few moments, leading to a degradation in overall service performance.
Multi-worker processes can take full advantage of multi-core system architectures, but if the number of worker processes is greater than the number of CPU cores, it increases the consumption of inter-process switching (Linux is a preemptive kernel). In general, the user configures a worker process that is equal to the number of cores and uses the worker_cpu_affinity configuration to bind the CPU core.

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.