We are using Magento 2.4.6. with product volume over 20K Centos 7 server, 32GB, 16core But sometime we face 502 bad gateway on site and we we check the server it shows php-fpm processes are running which is consuming 100% CPU but generally CPU does not hike above 40% Below are the configuration for PHP FPM:
pm = dynamic
pm.max_children = 100
pm.start_servers = 20
pm.min_spare_servers = 10
pm.max_spare_servers = 20
pm.max_requests = 500
pm.process_idle_timeout = 10s
pm.status_path = /status
ping.path = /ping
catch_workers_output = yes
slowlog = /var/log/php-fpm/www-stage-slow.log
php_flag[display_errors] = off
php_admin_flag[log_errors] = on
php_admin_value[error_log] = /var/log/php-fpm/www-stage-error.log
php_admin_value[memory_limit] = 2048M
php_admin_value[max_execution_time] = 3600
Can anyone suggest what is the fix and what we are missing in the configuration. Thanks in advance.