The ngin configuration file is as follows:
User nobody nobody;
Worker_processes 4; Nginx number of processes to open
Error_log Logs/error.log Notice;
PID Logs/nginx.pid;
Worker_rlimit_nofile 65535; For binding worker processes and CPUs, more than 2.4 of Linux cores are available
events{
use epoll; worker_connections 65536; //用于定义Nginx每个进程的最大连接数 }
The PHP-FPM configuration file is as follows:
5 //max_children is used to set the number of fastcgi processes, according to the official recommendation, less than 2GB memory server, can only open 64 processes, 4GB or more can open 200 processes.
The//rlimit_files is used to set the PHP-FPM limit on open file descriptors, which is 1024 by default.
the $//tag max_requests indicates how many requests per children are processed and is turned off, with the default setting of 500.
Ask:
1, the Nginx configuration file worker_processes and php-fpm in the relationship between Max_children?
2, the Nginx configuration file in Worker_connections and php-fpm in Rlimit_files, max_requests relationship?
Reply content:
The Ngin configuration file is as follows:
User nobody nobody;
Worker_processes 4; Nginx number of processes to open
Error_log Logs/error.log Notice;
PID Logs/nginx.pid;
Worker_rlimit_nofile 65535; For binding worker processes and CPUs, more than 2.4 of Linux cores are available
events{
use epoll; worker_connections 65536; //用于定义Nginx每个进程的最大连接数 }
The PHP-FPM configuration file is as follows:
5 //max_children is used to set the number of fastcgi processes, according to the official recommendation, less than 2GB memory server, can only open 64 processes, 4GB or more can open 200 processes.
The//rlimit_files is used to set the PHP-FPM limit on open file descriptors, which is 1024 by default.
the $//tag max_requests indicates how many requests per children are processed and is turned off, with the default setting of 500.
Ask:
1, the Nginx configuration file worker_processes and php-fpm in the relationship between Max_children?
2, the Nginx configuration file in Worker_connections and php-fpm in Rlimit_files, max_requests relationship?
There is no relationship at all. Ngnix as a front-office agent, it basically does not handle the request, but the request to php-fpm to deal with. In other words, Ngnix basically does not exist read-write files, databases, resources, such as IO-intensive operations, more is the routing, rewrite and other CPU-intensive operations, this time we would recommend the number of concurrent processes Ngnix set and CPU core number consistent. While PHP-FPM is the actual process of processing requests, in the process, IO operations more, in order to ensure concurrency, we will be based on the actual physical performance, as much as possible to set the number of concurrent processes. In addition, Nginx is not directly connected with each PHP-FPM processing process, but through a PHP-FPM master process for the relay, so the configuration of the process-related parameters between the basic no contact. However, the overall performance of the server has a short board effect, the performance will be poor between the two as a limitation, so both are properly configured to reflect the overall effect.