Home > Backend Development > PHP Tutorial > Performance configuration of nginx configuration nginx apache nginx php nginx rewrite

Performance configuration of nginx configuration nginx apache nginx php nginx rewrite

WBOY
Release: 2016-07-29 08:53:40
Original
1135 people have browsed it

Nginx worker process number

Syntax: worker_processes number;
Default: worker_processes 1;
Function: In master_worker running mode, define the number of worker processes. The number of worker processes directly affects performance. So, how many are appropriate? Based on business needs. Each worker is a single-threaded process, and it will call various modules to implement various functions. If it is determined that these modules will not cause blocking calls, then the number of processes can be the same as the number of CPU cores; otherwise, it can be slightly less.

Bind Nginx worker process to the specified CPU core

Syntax: worker_cpu_affinity cpumask [cpumask…]
Function: Assuming that each worker is very busy, if multiple processes are competing for the same CPU, synchronization problems will occur. On the contrary, if each worker process has its own CPU, complete concurrency is achieved.
Example:
worker_processes 4;
worker_cpu_affinity 1000 0100 0010 0001;

SSL hardware acceleration

Syntax: ssl_engine device;
Function: If there is an SSL hardware acceleration device on the server, it can be configured to speed up the processing of the SSL protocol. Users can use the command provided by OpenSSL to check whether there is an SSL hardware acceleration device: openssl engine -t

Execution frequency of system call gettimeofday

Syntax: timer_resolution t;
Function: By default, every time the kernel event call (such as epoll, select, poll, kqueue, etc.) returns, gettimeofday will be executed to implement the kernel clock to update the nginx cache clock. In early Linux, this cost was not small.

Nginx worker process priority setting

Syntax: worker_priority nice;
Default: worker_priority 0;
Function: In Linux and Unix, when many processes are in the executable state, the priority is used to determine which process the kernel chooses to execute this time. The size of the CPU time slice allocated to the process is also related to the priority. The higher the priority, the longer the time slice (for example, by default, the minimum time slice is 5ms and the maximum is 800ms). The priority is determined by a combination of static priority and dynamic adjustments made by the kernel based on the execution of the process (currently only +-5 adjustments). Nice is the priority of the process, and its value range is -20~+19, -20 is the highest priority, and +19 is the lowest priority. It is not recommended to set the nice value to be smaller than the kernel process (t is usually -5).

').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

The above introduces the performance configuration of nginx configuration, including nginx content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template