User Tools

Site Tools


php-fpm_investigation

Children Check

List the max children configuration for all php-fpm pools:

grep -v '^;\|^$' /etc/php-fpm.d/*.conf | awk '/pm.max_children/'

Example output:

/etc/php-fpm.d/site1.conf:pm.max_children = 300
/etc/php-fpm.d/site2.conf:pm.max_children = 10
/etc/php-fpm.d/site3.conf:pm.max_children = 300
/etc/php-fpm.d/site4.conf:pm.max_children = 14
/etc/php-fpm.d/site5.conf:pm.max_children = 14
/etc/php-fpm.d/site6.conf:pm.max_children = 14
/etc/php-fpm.d/www.conf:pm.max_children = 50

Process Check

Check the amount of processes running for each php-fpm pool:

ps aux --sort:-rss | awk '/php-fpm/ {print $1, $8, $11, $13}' | sort | uniq -c | sort -rn
Example output:

    137 502 S php-fpm: site2.com
     95 502 S php-fpm: site1.co.uk
     10 502 S php-fpm: site4.com
      8 502 S php-fpm: site6.co.uk
      7 502 S php-fpm: site3.co.uk
      5 apache S php-fpm: www

Netstat Check

netstat -pant | awk '/fpm/ {print $5, $6, $7}' | awk -F'[: /]' '{print $1, $3, $5}' | sort | uniq -c | sort -rn
Example output:
     10 10.x.x.x ESTABLISHED php-fpm
      7 127.0.0.1 ESTABLISHED php-fpm
      6 x.x.x.x SYN_SENT php-fpm
      3 127.0.0.1 CLOSE_WAIT php-fpm
      1 0.0.0.0 LISTEN php-fpm





Doesnt work yet:

awk  '!/^;|^$/ && /pm.max_children/' /etc/php-fpm.d/*.conf

php-fpm_investigation.txt · Last modified: 2024/05/23 07:26 by 127.0.0.1