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