php-fpm high cpu load causes random 500 error

 

to edit the php-fpm go to the following path:

 

/etc/php/7.4/fpm/pool.d/www.conf

 

 

PHP-FPM settings tutorial. max_servers, min_servers, etc.

 

 

find how many cores does your server have:

echo Cores = $(( $(lscpu | awk '/^Socket/{ print $2 }') * $(lscpu | awk '/^Core/{ print $4 }') ))

 

 

find how many MBs of Ram does every php-fpm use:

ps --no-headers -o "rss,cmd" -C php-fpm7.4 | awk '{ sum+=$1 } END { printf ("%d%s\n", sum/NR/1024,"M") }'

 

 

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

 

[29-Mar-2023 10:40:55] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it

Leave a Reply

Your email address will not be published. Required fields are marked *