PHP-FMP configuration-optimisation (Best practice)

Locked
pauliakas
Posts: 4
Joined: Tue 7. Dec 2021, 08:41

PHP-FMP configuration-optimisation (Best practice)

Post by pauliakas »

Anyone can share best practice PHP-FMP configuration

Have three users and about 20 small sites hosted.
KVM VPS 8 cores 48GB RAM.

But i think something wrong with my user PHP-FMP configuration. Sites first response time is not so good...
Now using:
Image

Should i change settings? Maybe someone can share his configuration?
User avatar
latifolia
Posts: 42
Joined: Wed 18. Aug 2021, 09:08

Re: PHP-FMP configuration-optimisation (Best practice)

Post by latifolia »

You can not optimize PHP-FPM without optimizing Apache as well.

First and foremost you need to switch to MPM_EVENT. I guess KeyHelp coming with MPM_WORKER by default.

Only then you can choose STATIC or DYNAMIC child processes generation. Choose STATIC if you dont mind to eat up RAM without doing anything, choose anything else like DYNAMIC if you need RAM and other resources to serve also for anything else.

I used to use STATIC but switch to DYNAMIC because I nee to do other things other than hosting sites.

Here are my snippets (4 Cores CPU).

B0.png

B1.png
For PHP-FPM, set pm.Max_Children = Max Thread in Apache, that way 1 child process in Apache will go along with 1 child process in PHP-FPM, side by side, accelerating the process. Best use in this scenario is for STATIC but really eating a lot of RAM. If you choose STATIC then set : Max Children = pm_min = pm_max. This config is for Dynamic with enough children to serve in beginning to reserve RAM for anything else but ready for traffic spike.

This configuration was STATIC and has been tested to server around 100k hits per second long months ago but since I need to use this server to do many more things then I switch to Dynamic (only change config in PHP-FPM not Apache). The diffeence is that your server need to instantiate every new requested child processes while in STATIC mode they are always already there standby.

Dont Forget, You may want to enable OPCACHE in php.ini with enough allocation (mine is 2GB). They really useful for cache hits.
Locked