This article is a mirror article of machine translation, please click here to jump to the original article.

View: 12399|Reply: 0

[Web] php-fpm.conf two crucial parameters

[Copy link]
Posted on 11/6/2014 9:35:52 AM | | |
  This specifies the connection, send, and read of PHP-CGITime, 300 seconds is enough, so mineserver504s rarely appearGatewayTime-out error. The most important thing isphp-fpm.confofSet up, which will directly lead to 502 Bad Gateway and 504 Gateway Time-out.
Let's take a closer look at some important parts of php-fpm.confparameter
php-fpm.conf has two crucial parameters, one is "max_children" and the other is "request_terminate_timeout"
I have two settings with values of "40" and "900", but this value is not universal, but needs to be calculated by myself.
    Here's how it's calculated:
      If yoursserviceinstrumentperformanceGood enough, and the broadband resources are sufficient, PHPScriptIf there are no loops or bugs, you can just set the "request_terminate_timeout" to 0s. 0s means that PHP-CGI runs all the time without a time limit. If you can't do this, that is, your PHP-CGI may have a certain bug, or your bandwidth is not enough or other reasons cause your PHP-CGI to fake death, then it is recommended that you assign a value to "request_terminate_timeout", which can be set according to the performance of your server. Generally speaking, the better the performance, the higher you can set it, 20 minutes -30 minutes is fine. Since my server PHP scripts take a long time to run, some can be more than 10 minutes, so I set it to 900 seconds so that it doesn't cause PHP-CGI to die and get the 502 Bad gateway error.

And how is the value of "max_children" calculated? In principle, the bigger the better, php-cgiprocessIf there are more, it will be processed quickly, and there will be few requests in the queue. max_children Generally speaking, under normal circumstances, a server consumes about 20M of memory per php-cgi, so I set my "max_children" to 40, 20M*40=800M, which means that all PHP-CGI consumed less than 800M at peak time, which is lower than my effective memory of 1Gb. And if my "max_children" is set smaller, such as 5-10, then php-cgi will be "very tiring", the processing speed is also very slow, and the waiting time is longer. If the request has not been processed for a long time, the 504 Gateway Time-out error will appear, and the php-cgi that is being processed will encounter a 502 Bad gateway error if it encounters problems.




Previous:Nginx php-fpm appears 502 solutions and tuning experiences
Next:2007 Office System Compatibility Pack Download
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com