PHP FPM Worker issue ( not responding)

922 views Asked by At

We are using an setup of NGINX - PHP FPM for Web Applications. Sometimes we've encountered that an 502 Gateway Timeout will occure. The FPM Status states:

● php7.4-fpm.service - The PHP 7.4 FastCGI Process Manager
   Loaded: loaded (/lib/systemd/system/php7.4-fpm.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2020-09-22 12:35:06 UTC; 1 weeks 5 days ago
     Docs: man:php-fpm7.4(8)
 Main PID: 3483 (php-fpm7.4)
   Status: "Processes active: 8, idle: 0, Requests: 92422, slow: 0, Traffic: 0req/sec"
    Tasks: 9 (limit: 4686)
   CGroup: /system.slice/php7.4-fpm.service
           ├─3483 php-fpm: master process (/etc/php/7.4/fpm/php-fpm.conf)
           ├─7444 php-fpm: pool POOLNAME
           ├─7447 php-fpm: pool POOLNAME
           ├─7448 php-fpm: pool POOLNAME
           ├─7449 php-fpm: pool POOLNAME
           ├─7450 php-fpm: pool POOLNAME
           ├─7451 php-fpm: pool POOLNAME
           ├─7452 php-fpm: pool POOLNAME
           └─7453 php-fpm: pool POOLNAME

Where all of our 8 Workers are active and non responding. After an restart all is back up and working. The Active and Idle worker will chance regarding the access of the website.

the following Pool Configuration is in place:

[POOLNAME]
user = www-data
group = www-data
listen = /run/php/POOLNAME-PHPV74.sock
listen.owner = www-data
listen.group = www-data
pm = ondemand
pm.max_children = 12
pm.process_idle_timeout = 10s
pm.max_requests = 140
request_terminate_timeout = 60
pm.status_path = /php-fpm_status
chdir = /
php_flag[display_errors] = on
php_admin_value[error_log] = /var/log/fpm/POOLNAME.log
php_admin_flag[log_errors] = on
php_admin_value[max_input_vars] = 1500
php_flag[display_startup_errors] = on
php_flag[expose_php]=off
php_admin_value[upload_max_filesize] = 200M
php_admin_value[post_max_size] = 200M
php_admin_value[max_execution_time] = 300
php_admin_value[memory_limit] = 256M

With additional lines in the php-fpm.conf:

emergency_restart_threshold = 5
emergency_restart_interval = 1m
process_control_timeout = 5s

Does anybody else had a similar issue and can point me in the right direction? (It is an Ubuntu 18.04.5 LTS running on AWS Lightsail if that helps).

Thanks, Dave

0

There are 0 answers