Rocky Linux 9 - PHP-FPM Settings


I installed Rocky Linux 9 and the system swapped from FCGID to PHP-FPM (Virtualmin Pro with the beta installer is installed)
And now I’m struggling a bit with these FPM settings.
What do you thing good settings are for a system with 32GB RAM?

Default settings are:
pm.max_children = 9999
pm.start_servers = 1
pm.min_spare_servers = 1
pm.max_spare_servers = 5

But that doesn’t seem very good - all seems very slow especially in admin areas from Wordpress

So I changed to these settings here:
pm.max_children = 82
pm.start_servers = 20
pm.min_spare_servers = 20
pm.max_spare_servers = 61

And over 20GB of RAM are gone :confused:

And now I’m trying with:
pm.max_children = 400
pm.start_servers = 100
pm.min_spare_servers 100
pm.max_spare_servers = 300

Which seems better.

I found online an PHP-FPM Process Calculator but I’m not sure what to fill in :frowning:
Total RAM is clear but reserved RAM? Is that for the system reserved?
RAM Buffer? Default on 10%??
Process size is by default on 32MB - is that enough?

Thanks for some ideas/advices

Hello there its not that simple to configure settings for FPM.

there are modes which FPM uses to switch between multiple settings
virtualmin default comes with ondemand which is pretty good by default other than the
“pm.max_children = 9999” it should be around 20-50 for mid range traffic site

so the default settings on FPM says use an ondemand mode with 1 start process and 1 spare process as soon as spare process gets some work (traffic hit) create another process until no of porcesses reach 9999 and will be killed as soon as traffic starts decreasing.

If you have to use your RAM you can switch to static with your required start process (according to traffic you recieve on your perticular server) so that FPM processes should always be listening for traffic rather than spawning as per traffic demands.

FOR DETAILED information on tweaking google this : “FPM modes Dynamic vs Ondemand vs Static”

Also the calculator seems to be asking for the amount of RAM you want to reserve for PHP FPM process other than OS process, MYSQL process or any other processes running on the same server.

Also the process size depends on the code quality of the project/site you’re running in your case you should figure that out but yes 32MB is more than enough size for FPM process by default.

1 Like

Thank you very much for all these details…
I see it’s not that easy - I gonna try different settings and than google for more details with that what you wrote :slight_smile:
Enough RAM is present on my server and the other apps like mysql don’t use too much
So I can easily spend 20-30GB RAM for my websites :slight_smile:
It’s just weird that my wordpress sites are so much slower than on my old server which had 5 years - fcgid vs phpfpm seems to be very different in usage
Need to know and learn more about all that :confused:

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.