Reference:
https://megamorf.gitlab.io/2021/03/08/analyse-and-calculate-php-fpm-runner-settings/
https://chrismoore.ca/2018/10/finding-the-correct-pm-max-children-settings-for-php-fpm/
[Total Available RAM] - [Reserved RAM] - [10% buffer] = [Available RAM for PHP]
Results:
[Available RAM for PHP] / [Average Process Size] = [max_children]
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]
https://gist.github.com/holmberd/44fa5c2555139a1a46e01434d3aaa512
https://spot13.com/pmcalculator/
Finding average FPM Memory size
ps --no-headers -o "rss,cmd" -C php-fpm | awk '{ sum+=$1 } END { printf ("%d%s\n", sum/NR/1024,"M") }'