Home > Backend Development > PHP Tutorial > linux - What does the php-fpm.conf parameter process_control_timeout mean?

linux - What does the php-fpm.conf parameter process_control_timeout mean?

WBOY
Release: 2016-10-10 11:56:25
Original
1496 people have browsed it

Through Baidu, read the original text and translate it into Chinese
process_control_timeout = 0

Set the timeout for the child process to accept the reuse signal from the main process. Available units: s (seconds), m (minutes), h (hours), or d (days) Default unit: s (seconds). Default value: 0

The child process accepts the reuse signal of the main process. What does the reuse signal mean?
When a url request is handled by nginx and handed over to php-fpm, what is the principle of this whole process? A php-fpm process can include multiple requests ?Is there any expert who can tell me about it? Thank you very much.

Reply content:

Through Baidu, read the original text and translate it into Chinese
process_control_timeout = 0

Set the timeout for the child process to accept the reuse signal from the main process. Available units: s (seconds), m (minutes), h (hours), or d (days) Default unit: s (seconds). Default value: 0

The child process accepts the reuse signal of the main process. What does the reuse signal mean?
When a url request is handled by nginx and handed over to php-fpm, what is the principle of this whole process? A php-fpm process can include multiple requests ?Is there any expert who can tell me about it? Thank you very much.

Let’s first briefly talk about the PHP request processing process.
The interaction between Nginx and PHP relies on the CGI interface. Because both implement the CGI interface, Nginx can hand over the received request to PHP and obtain the corresponding results from PHP and send them back to the client.
The most basic CGI implementation is to create a new PHP process for each request and close the process after the processing is completed. This method consumes a lot of resources in starting and closing the process, so it is not very efficient.
Then the FastCGI implementation method emerged, that is, starting a process and letting it handle multiple requests and then closing it. This method solves the problem of opening and closing the process for each request. But FastCGI has a disadvantage, that is, because a process can only handle one request at the same time, if multiple requests are received at the same time, they can only queue up and wait for processing by the FastCGI process.
The way to solve the problem that FastCGI can only process one request at the same time is to start multiple FastCGI processes. However, when multiple FastCGI processes are opened, there are management issues with these processes, such as how many processes should be opened, how to allocate requests to these processes as needed, etc. PHP-FPM is such a management program that manages the FastCGI process. Nginx first passes the request to PHP-FPM, and then PHP-FPM selects the appropriate FastCGI processing process for processing.

When PHP-FPM passes the request to the FastCGI processing process, process reuse is involved. In principle, PHP-FPM will select an idle FastCGI process to handle the request. Before processing, PHP-FPM will send a process reuse signal to the FastCGI process to prepare the FastCGI process to accept the request and process it. However, the FastCGI process is not always able to handle requests, that is, it cannot respond to process reuse signals (for example, suspended animation), so this parameter indicates how long PHP-FPM leaves the FastCGI process to respond to process reuse. If the signal times out, PHP-FPM will choose other ways (such as using other FastCGI processes) to handle the request.

fpm, the full name of fastcgi process manager, is specialized in managing fastcgi

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