Skip to content

Instantly share code, notes, and snippets.

@ursuleacv
Last active December 18, 2019 04:37
Show Gist options
  • Save ursuleacv/2b7c24c24ea8a15019a1422c3b8a5ecd to your computer and use it in GitHub Desktop.
Save ursuleacv/2b7c24c24ea8a15019a1422c3b8a5ecd to your computer and use it in GitHub Desktop.
Adjusting child processes for PHP-FPM (Nginx)
Alternate way to find php-fpm size in human readable format.
ps -eo size,pid,user,command --sort -size | awk '{ hr=$1/1024 ; printf("%13.2f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }' | grep php-fpm
pm.max_children = Total RAM dedicated to the web server / MAXIMUM child process size - in my case it was 85MB
The server has 8GB of RAM, so:
pm.max_children = 6144MB / 85MB = 72
pm.max_children = 70
pm.start_servers = 20
pm.min_spare_servers = 20
pm.max_spare_servers = 35
pm.max_requests = 500
https://myshell.co.uk/blog/2012/07/adjusting-child-processes-for-php-fpm-nginx/
https://serverpilot.io/community/articles/how-to-change-the-php-fpm-max_children-setting.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment