查看每一個php-fpm平均佔用系統內存,也適用看nginx/mysqld等,把php-fpm換成mysqldphp
ps --no-headers -o "rss,cmd" -C php-fpm | awk '{ sum+=$1 } END { printf ("%d%s\n", sum/NR/1024,"M") }' mysql
查看佔用內存nginx
[root@centos69 ~]# ps -ylC php-fpm --sort:rss sql
S UID PID PPID C PRI NI RSS SZ WCHAN TTY TIME CMDcentos
S 0 3082 1 0 80 0 6124 53280 ep_pol ? 00:00:00 php-fpmide
R 500 3085 3082 9 80 0 25708 57731 - ? 00:03:00 php-fpmphp-fpm
R 500 3086 3082 9 80 0 25712 57731 - ? 00:03:00 php-fpmspa
R 500 3083 3082 9 80 0 25716 57734 - ? 00:03:00 php-fpm內存
R 500 3087 3082 9 80 0 25720 57741 - ? 00:03:00 php-fpmcmd
R 500 3088 3082 9 80 0 25732 57738 - ? 00:02:59 php-fpm
R 500 3090 3082 9 80 0 25732 57735 - ? 00:02:59 php-fpm
R 500 3094 3082 9 80 0 25756 57764 - ? 00:02:59 php-fpm
R 500 3084 3082 9 80 0 25808 57764 - ? 00:03:00 php-fpm
R 500 3092 3082 9 80 0 25828 57761 - ? 00:02:59 php-fpm
R 500 3096 3082 9 80 0 25856 57768 - ? 00:02:59 php-fpm