Child pages
  • Apache vs PHP-FPM Bottleneck with Child Processes

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Include Page
LIB:_Version
LIB:_Version

Table of Contents
minLevel2
stylenone

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.

Warning
titleImportant:

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:

Code Block
languagebash
linenumberstrue
_is_present: 1
pm_max_children: 20
pm_max_requests: 20

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

Code Block
languagebash
linenumberstrue
StartServers: 5
<IfModule prefork.c>
MinSpareServers: 10
MaxSpareServers: 10
</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.

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 for WHM interface (WHM >> Home >> Software >> MultiPHP Manager).

Additional documentation

Localtab Group


Localtab
activetrue
titleSuggested documentation

Content by Label
showLabelsfalse
max5
showSpacefalse
cqllabel in ("ea4","php-fpm") and label = "whm" and space = currentSpace()


Localtab
titleFor cPanel users

Content by Label
showLabelsfalse
max4
showSpacefalse
cqllabel in ("ea4","php-fpm","cpanel")


Localtab
titleFor WHM users

Content by Label
showLabelsfalse
max5
showSpacefalse
cqllabel in ("ea4","php-fpm") and label = "whm" and space in ("currentspace()","CKB")


Localtab
titleFor developers

Content by Label
showLabelsfalse
max5
showSpacefalse
cqllabel in ("ea4","php-fpm") and space = "DD"