0

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.

1 Answer 1

0

pm.max_children=100 is too high for your setup.

Too many processes get spawned which 502ed your server.

I'd also suggest to use static strategy instead of dynamic.

Try this:

pm = static
pm.max_children = 20
1
  • ok, thanks for your information. Commented Nov 29 at 4:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.