OVERVIEW

APACHE SERVERS THAT USE THE PREFORK MPM WITH FEWER SERVER INSTANCES THAN THE MAXIMUM NUMBER OF PHP-FPM CHILD PROCESSES MAY EXPERIENCE PERFORMANCE ISSUES. THIS DOCUMENT EXPLAINS HOW TO RESOLVE THIS DEPENDENCY ISSUE.

IMPORTANT:

This issue and solution only apply to servers that run Apache’s prefork MPM.

THE ISSUE

In the following scenario, the PHP-FPM server’s configuration allows a maximum of 20 PHP-FPM child processes and the Apache server’s configuration allows five server instances.

The following example represents the PHP-FPM server’s configuration file:

  1. _is_present: 1
  2. pm_max_children: 20
  3. pm_max_requests: 20

The following example represents the Apache server’s configuration file:

  1. StartServers: 5
  2. <IfModule prefork.c>
  3. MinSpareServers: 10
  4. MaxSpareServers: 10
  5. </IfModule>

If the Apache server receives 20 requests, it immediately passes five of those requests to the available PHP-FPM child processes. After PHP-FPM processes those requests, Apache will pass another five requests to PHP-FPM.

WARNING:

For high-volume servers, this configuration can cause severe performance issues.

THE SOLUTION

To solve this issue, you must configure Apache to allow enough server instances to handle the maximum number of PHP-FPM child processes.

Set the Start Servers option in WHM’s Global Configuration interface (WHM >> Home >> Service Configuration >> Apache Configuration >> Global Configuration) to a value greater than or equal to the pm_max_children setting in WHM’s MultiPHP Manager interface (WHM >> Home >> Software >> MultiPHP Manager).