I have NGINX and php5-fpm. Several times per hour my trang web stucks and in logfile I see the following:

WARNING: [pool www] server reached pm.max_children setting (5), consider raising it.

The /etc/php5/fpm/pool.d/www.conf tệp tin contains the following configuration:

pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3

Server: AMD Opteron™ 3280, Octo-Core, 8x 2.4 GHz, 16 GB DIMM (DDR3).

What numbers should I put in www.conf tệp tin for this server?

asked Feb 16, 2013 at 10:30

There are many possible reasons why your PHP-FPM would reach the max_children. Most common ones are:

  • A lot of parallel requests from your clients
  • Slow execution of the PHP scripts
  • Very low setting of the max_children

Looking at the specs of your machine, assuming there is nothing else phàn nàn PHP+Nginx running, I think you could mix it much higher phàn nàn 5. You say you have 8 Cores, usually Nginx needs much less CPU phàn nàn PHP, sánh with 5 children you will probably never be able vĩ đại use all of them. I'm usually setting it vĩ đại something lượt thích the number of cores x 2 or number of cores x 4, depending on the memory consumption of your PHP scripts.

answered Feb 16, 2013 at 13:50

5

I found that by setting the pm.max_requests value (which is commented out by default) helped in fixing these errors. This setting forces child requests vĩ đại respawn after executing a certain number of requests and can be helpful if there are memory leaks somewhere in your code or 3rd tiệc ngọt libs.

In /etc/php-fpm.d/www.conf:

pm.max_requests = 500

answered Feb 27, năm trước at 9:46

1

I had the same problem whith my docker php-fpm and I fixed it by modifing parameters in these files: /usr/local/etc/php-fpm.d/www.conf /usr/local/etc/php-fpm.d/www.conf.default

The new parameters are :

pm = dynamic
pm.max_children = 25
pm.start_servers = 10
pm.min_spare_servers = 5
pm.max_spare_servers = 20
pm.max_requests = 500

answered Oct 19, 2022 at 10:10

You must log in vĩ đại answer this question.

Not the answer you're looking for? Browse other questions tagged

.