Jelf

Member
Jun 26, 2016
10
1
3
Redmond
cPanel Access Level
Root Administrator
PHP-FPM Coming up the learning curve

This post has some background followed by 2 questions.

My domains are hosted on a VPS running Linux, Apache 2.4 and PHP 7.2

2 Cores
30 GB SSD Storage
2 GB RAM
1 TB Bandwidth

2 domains are parked
3 domains are low volume
1 domain is high volume

My immediate goal is to tune PHP-FPM to support the high volume domain.

I am a software developer in the field of online maps. Most of the transactions on the high volume domain result in one of my interactive maps appearing on the user’s screen. For example, the link below opens a map that can display various layers of GIS data related to rain and flood events. If you are curious for more information about the map, please click “Map tips” in the upper left corner.

<3rd party link removed>

The source file to display the map is about 1MB and is a combination of PHP and javascript. The PHP code:
* Does data validate on url parameters
* Reads a txt file that is hosted on my server
* Passes a bunch of data to javascript

There is no database involved.

I have root access.

After reading a bunch about PHP-FPM I have activated it just for the high volume domain.
I also changed Apache config from ‘worker' MPM to ‘event' MPM.

My server now has a master yaml file at
/var/cpanel/ApachePHPFPM/system_pool_defaults.yaml

And my server also has a master conf file that includes:
pm = ondemand
pm.max_children = 5
pm.max_requests = 25
pm.max_spare_servers = 5
pm.min_spare_servers = 1
pm.process_idle_timeout = 10
pm.start_servers = 0

Below are a couple of questions to help get myself pointed in the right direction. No doubt I will have additional questions along the way.

1. Does my decision to only turn PHP-FPM ‘on’ for my high volume domain sound like the right way to go?

2. I am aware that with pm=ondemand (default on my server) that most of the settings listed above (pm.max_children, etc) are ignored. Given my server’s resources and usage noted above, should I stay with pm=ondemand or investigate dynamic or static. I did see this interesting article recommending static.
<3rd party link removed>

And for other newbies like me that might read this, here is thread that describes how to change PHP-FPM settings. Basically you edit a yaml file and then run a command to generate a conf file.
 
Last edited by a moderator:

cPanelLauren

Forums Analyst II
Staff member
Nov 14, 2017
8,050
652
263
Houston
cPanel Access Level
DataCenter Provider

Jelf

Member
Jun 26, 2016
10
1
3
Redmond
cPanel Access Level
Root Administrator
I am not using "prefork MPM" so your third link does not apply.
Yes, I have been looking through the other 2 links you provided.

Yesterday my server had 136,000+ hits. Most of those were from users opening various maps I produced as described in my post. Response time only slowed once when the 'Apache status' screen showed that "requests currently being processed" + "idle workers" was very close to 150. Where do I look to raise this 150 limit given that I am using pm = ondemand? My understanding from the docs is that pm=demand means my server ignores the settings for:
pm.max_children = 5
pm.max_requests = 25
pm.max_spare_servers = 5
pm.min_spare_servers = 1
pm.start_servers = 0