Hello everyone, I recently migrated a high-traffic utility billing service to a fresh AlmaLinux 9 instance running Nginx and PHP-FPM 8.2. Under standard daily loads everything performs cleanly, but we run into severe 504 Gateway Timeout issues during monthly peak usage windows. When monitoring system resources, overall CPU and memory utilization stay well within safe limits, yet PHP-FPM child workers quickly saturate and queue incoming requests until the web server drops them. While testing user query workflows on this website during these peak periods, response latency climbs from a few hundred milliseconds to over twenty seconds before requests eventually time out. I have already adjusted pm.max_children, increased worker connections, and confirmed the database queries are indexed and responsive, but the queue still stalls at the socket level during sudden surges. Are there specific sysctl network backlog settings, FastCGI buffer sizes, or systemd resource slice restrictions on AlmaLinux 9 that you would recommend tuning for bursty, read-heavy PHP web applications?
This does not look like a network sysctl or FastCGI buffer issue.
If PHP-FPM reaches pm.max_children while CPU and memory remain low, check what the workers are waiting for. Enable the PHP-FPM slow log and status page first.
request_slowlog_timeout = 5s
slowlog = /var/log/php-fpm/www-slow.log
somaxconn or listen.backlog may help with queue overflow, but they will not fix workers blocked for 20+ seconds.