Skip to content

Instantly share code, notes, and snippets.

@budiantoip
Last active November 13, 2024 07:33
Show Gist options
  • Save budiantoip/27413558122d90cfe25dca1193f176fb to your computer and use it in GitHub Desktop.
Save budiantoip/27413558122d90cfe25dca1193f176fb to your computer and use it in GitHub Desktop.
Calculate Processes

Calculate processes given a specific process name

Let's start with listing the processes of a php-fpm:

ps -C php-fpm

Display the process size:

ps -C php-fpm -o rss=

Calculate the total size:

ps -C php-fpm -o rss= | paste -s -d+ - | bc

Get the average process size:

ps -C php-fpm -o rss= | awk '{sum+=$1; count+=1} END {if (count > 0) print sum/count; else print "No processes found."}'

References

PHP-FPM Process Calculator

https://spot13.com/pmcalculator/

Apache MaxRequestWorker

https://alibaba-cloud.medium.com/apache-performance-tuning-on-linux-93f5330f7808

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment