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

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

Logitech RF mouse suddenly stop scrolling on Ubuntu 22.04LTS

I have an M238 RF mouse that works perfectly fine on Windows and suddenly stop…

7 days ago

Zastone Radios Software

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

3 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

2 Elements Yagi UHF antenna for 410Mhz

This 2 elements yagi antenna is intended for the 70cm UHF band center frequency is…

2 years ago

WLN Softwares

WLN UHF Radio programming softwares and image for the following models below. The small radio…

2 years ago