PHP under IIS FastCGI - How to determine the best values for InstanceMaxRequests and PHP_FCGI_MAX_REQUESTS

PHP under IIS FastCGI - How to determine the best values for InstanceMaxRequests and PHP_FCGI_MAX_REQUESTS

I'm running PHP 5.4 (yes, I know it's old and needs to be upgraded) as a FastCGI component in IIS 8.5 on Windows Server 2012 R2. While I was tuning the settings I read the https://docs.microsoft.com/en-us/iis/application-frameworks/running-php-applications-on-iis/configure-php-process-recycling-behavior article.

That article recommends setting InstanceMaxRequests and PHP_FCGI_MAX_REQUESTS to 10 000 - but it doesn't explain why. Is there a better strategy to determine what the best value for a specific environment is, or is it safe to hardcode it as 10 000, as per the article?

How do I determine what the best InstanceMaxRequests and PHP_FCGI_MAX_REQUESTS values are for my own environment? How do I work out what values I should use?

Respuesta1

I have run my production environment with a value of 20 000 for at least 5 years without issue. (I run my development environments with a value of 200.)

The question really is this: how often do you want (or need) new PHP processes to be created to handle incoming traffic? If you're seeing lots of HTTP 500 errors in your logs, try decreasing this value.

Setting it too low will cause many php-cgi.exe processes to be created and destroyed throughout the day, which could cause a slight delay in processing requests. Setting it too high would allow a memory leak to go unchecked for longer, or could lead to otherwise unexplained HTTP 500 errors if the process crashes (though I think this unlikely).

información relacionada