This is a personal note for myself to remember the process I used to tune the php-8.2-fpm service on this computer running this website.

This site is running on a re-purposed laptop to work as a home server since running this website on a shared hosting has become erratic due to increasing traffic on the website – 6yrs and 297 days running now since I started the website (as of this writing). The shared hosting account that previously runs this website is running out of memory resources due to occasional spike in traffic. I also cannot run this website together with its database on a single computer since it is overloading the laptop a Core 2 Dou computer with 3GB of RAM.

So to make this website run on this computer since hosting it on a VPS server is a little bit expensive for me at the moment. I decided to use my home fiber bandwidth which is I think would be enough to run this website for the occasional spike in traffic. I configured this website on top of Apache2 / PHP-FPM / opcache and Redis server and separate the MySQL database to run on another netbook Atom processor with 2GB ram running on SSD.

The issues that I need to resolve is to prevent the PHP-FPM process to take all the memory resources upon computer start up. So I need to calculate properly the PHP consumption being used by PHP-FPM.

To check I execute this command:

$ ps -C php-fpm8.2 -o rss=

Ignoring the first line on the output I noticed that PHP is using around 75Mb of memory. So to configure I will allocate 2GB of RAM for PHP and configure the php-fpm service to run with dynamic allocation.

So 2000MB / 75MB = 30.769

Therefore I will set the pm.max_children to 30, and will set additional parameters accordingly.

pm.max_children = max_children

pm.start_servers = 25% of max_children

pm.min_spare_servers = 25% of max_children

pm.max_spare_servers = 75% of max_children

Applying the resulting calculations this is now my php-fpm configuration

pm = dynamic
pm.max_children = 30
pm.start_servers = 8
pm.min_spare_servers= 8
pm.max_spare+servers= 23
pm.max_requeste=0

Save the configuration in my php-fpm configuration file, restart the server and voila. No startup freeze and php-fpm process hugging up the memory resources.

Ephraim Gariguez

Recent Posts

Can’t change SSH port Armbian 24.5.1 Bookworm Linux 6.6.31 current-sunxi – Fixed

I'm on Orange Pi One Armbian 24.5.1 Bookworm with Linux 6.6.31-current-sunxi I found a fix…

3 months ago

Realtek RTL8111/8168/8411 PCIe GBE NIC – dissapear unusable after Kernel 6.9 update from 6.8 PopOS! work around…

I've been using Linux PopOS for a year now on my old Samsung RF411 notebook…

3 months ago

Logitech RF mouse suddenly stop scrolling on Ubuntu 22.04LTS

Note: This procedure is also tested to work with Pop!_OS 22.04 LTS I have an…

5 months ago

Zastone Radios Software

The following are software for radios by Zastone Technology this is publicly and freely available…

8 months ago

Kicad 6.0 Fix or Workaround for OpenGL required version 1.5

Kicad 6.0 is an schematic entry and pcb layout editor software that is popularly used…

2 years ago

2 Elements Yagi VHF antenna for 144Mhz

If you liked the 3 elements yagi, this antenna build is very close to the…

2 years ago