to edit the php-fpm go to the following path:
/etc/php/7.4/fpm/pool.d/www.conf
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