ps --no-headers -o "rss,cmd" -C php-fpm | awk '{ sum+=$1 } END { printf ("%d%s\n", sum/NR/1024,"M") }'
ps --no-headers -o "rss,cmd" -C apache2 | awk '{ sum+=$1 } END { printf ("%d%s\n", sum/NR/1024,"M") }'
Created
July 26, 2017 07:03
-
-
Save iamstoick/a4eafe359107b6bd41b6529a07f803a0 to your computer and use it in GitHub Desktop.
How to check an average memory usage by single PHP-FPM process
hi
i run this command:
ps --no-headers -o "rss,cmd" -C php-fpm | awk '{ sum+=$1 } END { printf ("%d%s\n", sum/NR/1024,"M") }'
but return negative number
-2147483647M
hi
i run this command:
ps --no-headers -o "rss,cmd" -C php-fpm | awk '{ sum+=$1 } END { printf ("%d%s\n", sum/NR/1024,"M") }'
but return negative number
-2147483647M
hi
i run this command:
ps --no-headers -o "rss,cmd" -C php-fpm | awk '{ sum+=$1 } END { printf ("%d%s\n", sum/NR/1024,"M") }'
but return negative number
-2147483647M
Check your PHP-fpm version.
ps --no-headers -o "rss,cmd" -C php-fpm{version-here} | awk '{ sum+=$1 } END { printf ("%d%s\n", sum/NR/1024,"M") }'
For PHP 7.3
ps --no-headers -o "rss,cmd" -C php-fpm7.3 | awk '{ sum+=$1 } END { printf ("%d%s\n", sum/NR/1024,"M") }'
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
pm.max_children
= Total RAM dedicated to the web server / Max child process size