Identifying causes of "seems busy" entries
Alex <[email protected]> Tue, 5 Aug 2025 19:15:35 -0400
| Newsgroups | gmane.comp.php.general |
|---|---|
| Message-ID | <CAB1R3sgK2Haiz9FaNOWAT7Yq4F4Y7zEmLAf-FUy5KqgvC1yEAQ@mail.gmail.com> |
--000000000000781ec5063ba6678e
Content-Type: text/plain; charset="UTF-8"
Hi,
I have a fedora40 system with apache-2.24.62 and php-8.3.20 (upgrading to
fedora42 soon). I'm trying to identify how best to optimize php-fpm for
problems involving "seems busy" errors. I'm sure this is a FAQ, but I'm
really stuck. I've been using php-fpm and tweaking it for years, but our
site is constantly growing and I don't know what I'm missing. Apache and
php-fpm are the only processes on the system. The server is a Xeon Gold
6128 @ 3.4Ghz with 128GB of RAM.
[05-Aug-2025 15:36:58] WARNING: [pool mysite] seems busy (you may need to
increase pm.start_servers, or pm.min/max_spare_servers), spawning 8
children, there are 91 idle, and 137 total children
Here is the output from the /status-fpm page:
pool: mysite
process manager: dynamic
start time: 04/Aug/2025:13:19:22 -0400
start since: 105419
accepted conn: 141290
listen queue: 0
max listen queue: 0
listen queue len: 0
idle processes: 122
active processes: 3
total processes: 125
max active processes: 52
max children reached: 0
slow requests: 1575
I don't understand how it could suggest I should increase
#_spare_servers when there are currently 122 idle processes.
Here is my config file:
[mysite]
user = idlls
group = idlls
listen = /run/php-fpm/mysite.sock
listen.backlog = 1000
listen.acl_users = apache,nginx,idlls
listen.allowed_clients = 127.0.0.1
pm = dynamic
pm.max_children = 225
pm.start_servers = 110
pm.min_spare_servers = 110
pm.max_spare_servers = 125
pm.max_requests = 500
pm.status_path = /status-fpm
ping.path = /ping
access.format = "[%t] %m
%{REQUEST_SCHEME}e://%{HTTP_HOST}e%{REQUEST_URI}e %f pid:%p took:%ds
mem:%{mega}Mmb cpu:%C%% status:%s
{%{REMOTE_ADDR}e|%{HTTP_USER_AGENT}e}"
slowlog = /var/log/php-fpm/mysite-slow.log
request_slowlog_timeout = 4s
php_flag[display_errors] = on
php_admin_value[error_log] = /var/log/php-fpm/mysite-error.log
php_admin_flag[log_errors] = on
php_value[session.save_handler] = files
php_value[session.save_path] = /var/lib/php/session
php_value[soap.wsdl_cache_dir] = /var/lib/php/wsdlcache
I've also determined each process consumes about 125MB each:
$ ps --no-headers -o "rss,cmd" -C php-fpm | awk '{ sum+=$1 } END {
printf ("%d%s\n", sum/NR/1024,"Mb") }'
125Mb
Apache shows about five processes and less than 1GB of RAM using the
same method as above.
I'm pretty sure my php-fpm numbers should be much, much larger, but
I'd appreciate some advice on what would be best.
Thanks,
Alex
--000000000000781ec5063ba6678e
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Hi,<div>I have a fedora40 system with apache-2.24.62 and p=
hp-8.3.20 (upgrading to fedora42 soon). I'm trying to identify how best=
to optimize php-fpm for problems involving "seems busy" errors. =
I'm sure this is a FAQ, but I'm really stuck. I've been using p=
hp-fpm and tweaking it for years, but our site is constantly growing and I =
don't know what I'm missing.=C2=A0<span style=3D"font-family:arial,=
sans-serif;color:rgb(0,0,0)">Apache and php-fpm are the only processes on t=
he system. The server is a Xeon Gold 6128 @ 3.4Ghz with 128GB of RAM.</span=
></div><div><br></div><div><font face=3D"monospace">[05-Aug-2025 15:36:58] =
WARNING: [pool mysite] seems busy (you may need to increase pm.start_server=
s, or pm.min/max_spare_servers), spawning 8 children, there are 91 idle, an=
d 137 total children<br></font></div><div><br></div><div>Here is the output=
from the /status-fpm page:</div><div><pre style=3D"color:rgb(0,0,0)">pool:=
mysite
process manager: dynamic
start time: 04/Aug/2025:13:19:22 -0400
start since: 105419
accepted conn: 141290
listen queue: 0
max listen queue: 0
listen queue len: 0
idle processes: 122
active processes: 3
total processes: 125
max active processes: 52
max children reached: 0
slow requests: 1575</pre><pre style=3D"color:rgb(0,0,0)"><font face=
=3D"Arial, Helvetica, sans-serif">I don't understand how it could sugge=
st I should increase #_spare_servers when there are currently 122 idle proc=
esses.</font></pre><pre style=3D"color:rgb(0,0,0)"><font face=3D"Arial, Hel=
vetica, sans-serif">Here is my config file:</font></pre><pre style=3D"color=
:rgb(0,0,0)">[mysite]<br>user =3D idlls<br>group =3D idlls<br>listen =3D /r=
un/php-fpm/mysite.sock<br>listen.backlog =3D 1000<br>listen.acl_users =3D a=
pache,nginx,idlls<br>listen.allowed_clients =3D 127.0.0.1<br>pm =3D dynamic=
<br>pm.max_children =3D 225<br>pm.start_servers =3D 110<br>pm.min_spare_ser=
vers =3D 110<br>pm.max_spare_servers =3D 125<br>pm.max_requests =3D 500<br>=
pm.status_path =3D /status-fpm<br>ping.path =3D /ping<br>access.format =3D =
"[%t] %m %{REQUEST_SCHEME}e://%{HTTP_HOST}e%{REQUEST_URI}e %f pid:%p t=
ook:%ds mem:%{mega}Mmb cpu:%C%% status:%s {%{REMOTE_ADDR}e|%{HTTP_USER_AGEN=
T}e}"<br>slowlog =3D /var/log/php-fpm/mysite-slow.log<br>request_slowl=
og_timeout =3D 4s<br>php_flag[display_errors] =3D on<br>php_admin_value[err=
or_log] =3D /var/log/php-fpm/mysite-error.log<br>php_admin_flag[log_errors]=
=3D on<br>php_value[session.save_handler] =3D files<br>php_value[session.s=
ave_path] =C2=A0 =C2=A0=3D /var/lib/php/session<br>php_value[soap.wsdl_cach=
e_dir] =C2=A0=3D /var/lib/php/wsdlcache<br></pre><pre style=3D"color:rgb(0,=
0,0)"><font face=3D"Arial, Helvetica, sans-serif">I've also determined =
each process consumes about 125MB each:</font></pre><pre style=3D"color:rgb=
(0,0,0)"><font face=3D"Arial, Helvetica, sans-serif">$ </font>ps --no-heade=
rs -o "rss,cmd" -C php-fpm | awk '{ sum+=3D$1 } END { printf =
("%d%s\n", sum/NR/1024,"Mb") }'
125Mb</pre><pre style=3D"color:rgb(0,0,0)"><font face=3D"arial, sans-serif"=
>Apache shows about five processes and less than 1GB of RAM using the same =
method as above.</font></pre><pre style=3D"color:rgb(0,0,0)"><font face=3D"=
arial, sans-serif">I'm pretty sure my php-fpm numbers should be much, m=
uch larger, but I'd appreciate some advice on what would be best.</font=
></pre><pre style=3D"color:rgb(0,0,0)"><font face=3D"arial, sans-serif">Tha=
nks,
Alex</font></pre><pre style=3D"color:rgb(0,0,0)"><br></pre><pre style=3D"co=
lor:rgb(0,0,0)"><br></pre><pre style=3D"color:rgb(0,0,0)"><br></pre><pre st=
yle=3D"color:rgb(0,0,0)"><br></pre></div></div>
--000000000000781ec5063ba6678e--