Scratch pad

From SPOT CHECK IT
Revision as of 01:27, 12 April 2022 by Admin (talk | contribs)
Jump to: navigation, search

This page is to keep items I will organize on the page later or ideas.

Analyse and calculate php-fpm runner settings https://megamorf.gitlab.io/2021/03/08/analyse-and-calculate-php-fpm-runner-settings/


Get average memory of the php-fpm process

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


Get memory of all php-fpm processes

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


How many cores does server have.

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


php-fpm settings

https://thisinterestsme.com/php-fpm-settings/


Top 10 processes uisng memory

ps auxw|head -1;ps auxw|sort -rn -k4|head -10


Get 20 Highest mem users.

echo [PID]  [MEM]  [PATH] &&  ps aux | awk '{print $2, $4, $11}' | sort -k2rn | head -n 20

Get highest cpu users.

ps -eo pcpu,pid,user,args | sort -k 1 -r | head -20


Apache tuning.

https://hostadvice.com/how-to/how-to-tune-and-optimize-performance-of-apache/

Estimate the Thrashing Point

https://www.liquidweb.com/kb/apache-performance-tuning-swap-memory/