Why Is PHP-FPM Only Using One Process?-Collection of common programming errors
Looking at my PHP-FPM stats page, it looks like only one process is handling all of the connections right now.
My guess is that requests are being executed so quickly, thus far, that it doesn’t need to use another process yet. Would this be the case?
Here’s what I’m seeing in my PHP-FPM stats page:
pool www
process manager static
start since 432796
accepted conn 90399
listen queue 0
max listen queue 1
listen queue len 128
idle processes 63
active processes 1
total processes 64
max active processes 6
max children reached 0
This is what my PHP-FPM Config looks like:
[General]
pid = /var/run/php5-fpm.pid
error_log = /var/log/php5-fpm.log
syslog.ident = php-fpm
syslog.facility = 24
log_level = unknown value
emergency_restart_interval = 0s
emergency_restart_threshold = 0
process_control_timeout = 0s
process.max = 0
process.priority = undefined
daemonize = yes
rlimit_files = 30000
rlimit_core = 0
events.mechanism = epoll
[www]
prefix = undefined
user = www-data
group = www-data
listen = 127.0.0.1:9000
listen.backlog = 128
listen.owner = undefined
listen.group = undefined
listen.mode = undefined
listen.allowed_clients = 127.0.0.1
process.priority = undefined
pm = static
pm.max_children = 64
pm.start_servers = 8
pm.min_spare_servers = 4
pm.max_spare_servers = 10
pm.process_idle_timeout = 10
pm.max_requests = 12800
pm.status_path = /fpm
ping.path = undefined
ping.response = undefined
access.log = undefined
access.format = undefined
slowlog = /var/log/www.log.slow
request_slowlog_timeout = 5s
request_terminate_timeout = 120s
rlimit_files = 30000
rlimit_core = 0
chroot = undefined
chdir = /
catch_workers_output = yes
security.limit_extensions = .php .phar
-
Why Is PHP-FPM Only Using One Process?
Because… 1 is enough. But it doesn’t mean that the number of active processes always is 1.
Split the terminal into 2 regions: in the first one type:
$ watch 'lynx -dump http://domain.com/fpm'
and in the second one, try something like this:
$ ab -c 1000 -n 10000 http://domain.com/fpm
then see what’s going on in the first region:
pool: www process manager: dynamic start time: 04/Sep/2012:23:19:24 +0700 start since: 3441 accepted conn: 42296 listen queue: 0 max listen queue: 8 listen queue len: 128 idle processes: 18 active processes: 3 total processes: 21 max active processes: 21 max children reached: 0