Issue
PHP process exhaustion can lead to slow site response times or even cause the request to 'time out' altogether, presenting as an unresponsive site. This issue is commonly referred to as skip-spawning or request queueing, and it occurs when a request bypasses caching and hits a web server when there are no available PHP processes to handle it. This results in the request getting queued, which means that pages may be slow to load or eventually time out, resulting in a Temporarily Unavailable
error on the site and a HTTP 503
error in the request logs.
Note, the issue is not due to insufficient memory allocated for each individual PHP process, which is set by the PHP memory limit. Rather, the issue is due to insufficient concurrent PHP processes. The key indicator of this issue is an error like the following in the fpm-error.log:
WARNING: [pool sitename] server reached max_children setting (2), consider raising it
Resolution
You can address the issue in a number of ways. Turn on caching, which offloads requests to your load balancers instead of your web servers. You can optimise your site and reduce the amount of data loading on a page to allow page requests to complete faster, reducing the likelihood of requests backing up. It's important to balance the need for memory with the number of available PHP processes. If your PHP memory limit is above the platform default of 128 MB, you are limiting the number of available processes. Consider adjusting the memory limit to best accommodate your site's memory needs with the number of concurrent connections.
It may perhaps be necessary for some additional memory to be available for some specific paths on your site to function correctly. And to accomodate this, the PHP memory limit has been raised. If that's the case, a better approach is to set the global memory limit back to the default of 128MB (which would increase the number of available PHP processes for your site), and set a conditional increased memory limit just for the specific paths that need additional memory. Adjustments to your PHP settings can be made via your Acquia Cloud UI, and we provide a guide on Conditionally increasing memory limits.
Finally, if none of the preceding solutions are sufficient or possible, you can upsize your server(s) to gain additional memory and more PHP processes. To proceed with an upsize, either contact your account manager, or for ACP self-service customers, see our guide on how to manage your server.