Overview
Apache servers utilizing the prefork
Multi-Processing Module (MPM) may encounter performance issues if the number of server instances is less than the maximum number of PHP-FPM child processes. This document outlines how to effectively address these dependency conflicts.
Important: This issue and its corresponding solution are exclusively applicable to servers running Apache's
prefork
MPM.
The Issue
Consider a scenario where the PHP-FPM server's configuration permits a maximum of 20 PHP-FPM child processes, while the Apache server's configuration allows only five server instances.
The PHP-FPM server's configuration file might appear as follows:
1 |
_is_present: 1 |
Conversely, the Apache server's configuration file could be structured like this:
1 |
StartServers: 5 |
If the Apache server receives 20 requests, it will initially pass ten of these requests to the available PHP-FPM child processes. Once PHP-FPM has processed these, Apache will then forward the remaining ten requests to PHP-FPM.
Warning: For servers handling high volumes of traffic, this configuration can lead to significant performance degradation.
The Solution
To rectify this problem, it is essential to configure Apache to allocate a sufficient number of server instances to manage the maximum allowed PHP-FPM child processes. This can be achieved by adjusting the following options within WHM’s Global Configuration interface (accessible via WHM » Home » Service Configuration » Global Configuration):
- Minimum Spare Servers
- Maximum Spare Servers
- Max Request Workers
These settings should be configured to a value that is greater than or equal to the pm_max_children
setting specified in the PHP-FPM server’s configuration file.