Skip to content

FPM Status: active processes greater than pm.max_children #14212

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
bcremer opened this issue May 13, 2024 · 3 comments
Open

FPM Status: active processes greater than pm.max_children #14212

bcremer opened this issue May 13, 2024 · 3 comments

Comments

@bcremer
Copy link
Contributor

bcremer commented May 13, 2024

Description

Given the following FPM Pool configuration the Pool is configured using 1500 static workers and a listen.backlog of 100:

$ cat /etc/php/8.3/fpm/pool.d/backoffice.conf 
[backoffice]
listen = /run/php8.3-fpm_backoffice.sock
listen.backlog = 100

pm = static
pm.max_children = 1500
pm.status_path = /php8.3-fpm-status-backoffice.php

; The number of requests each child process should execute before respawning. This can be useful to work around memory leaks
pm.max_requests = 2000

The listen.backlog works like expected on the socket.

$ ss -lxn src ==  /run/php8.3-fpm_backoffice.sock
Netid                      State                       Recv-Q                      Send-Q                                                              Local Address:Port                                              Peer Address:Port                      Process
u_str                      LISTEN                      0                           100                                               /run/php8.3-fpm_backoffice.sock 47129                                                        * 0

Without high traffic total processes reports 1500 as expected.

$ curl -s 127.0.0.1:80/php8.3-fpm-status-backoffice.php
pool:                 backoffice
process manager:      static
start time:           13/May/2024:04:02:02 +0200
start since:          22533
accepted conn:        3057525
listen queue:         0
max listen queue:     0
listen queue len:     0
idle processes:       1460
active processes:     40
total processes:      1500
max active processes: 549
max children reached: 0
slow requests:        0

When generating high concurrent requests using a tool like siege or k6 I can observe the following output from the status page:

$ curl 127.0.0.1:80/php8.3-fpm-status-backoffice.php
pool:                 backoffice
process manager:      static
start time:           08/May/2024:04:02:01 +0200
start since:          19565
accepted conn:        10120636
listen queue:         0
max listen queue:     0
listen queue len:     0
idle processes:       1
active processes:     3347
total processes:      3348
max active processes: 3503
max children reached: 0
slow requests:        0

active processes/total processes/max active processes are way over the defined pm.max_children = 1500.

How can active processes be greater than pm.max_children?

Also max children reachedreports 0.

Relates to: #9943 (comment)

PHP Version

PHP 8.3.6

Operating System

Debian 11

@bcremer
Copy link
Contributor Author

bcremer commented May 13, 2024

Maybe related:

I can also observe that the number of requests I can measure via the FPM access.log does not match the delta for accepted conn for a given timespan.

The accepted conn delta is approx double the abount of requests shown in the fpm access log.

@txuna
Copy link
Contributor

txuna commented Jun 2, 2025

@bcremer Is it still occurring?

@s2x
Copy link

s2x commented Jun 3, 2025

I also have the same problem. We wanted to use this metric to scale pods but unfortunately it returns incorrect results.

fpm settings:

pm = static
pm.max_children = 20

version: PHP 8.4.7 (fpm-fcgi) (built: May 8 2025 21:27:16) (NTS)

can be reproduced by sending large traffic to status php-fpm endpoint

no-load status
pool: www
process manager: static
start time: 03/Jun/2025:13:11:48 +0000
start since: 23846
accepted conn: 154295
listen queue: 0
max listen queue: 20
listen queue len: 4096
idle processes: 19
active processes: 1 --- one active for status page
total processes: 20  --- this is fine
max active processes: 1597
max children reached: 0
slow requests: 0
memory peak: 14680064

when we run wrk http://localhost/status

pool: www
process manager: static
start time: 03/Jun/2025:13:11:48 +0000
start since: 23914
accepted conn: 158110
listen queue: 0
max listen queue: 20
listen queue len: 4096
idle processes: 0
active processes: 698
total processes: 698 --- sooo big number
max active processes: 1597
max children reached: 0
slow requests: 0
memory peak: 14680064

The number of php processes, checked with the ps command, is correct, so the problem is probably with the display.

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

No branches or pull requests

5 participants