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).
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.