Question

Trying to set max_children and related settings

We have a client POUNDING our API. And we’re seeing issues with that. Error logs looks like this:

[13-Jul-2021 21:51:22] WARNING: [pool freshworks] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 0 idle, and 4 total children [13-Jul-2021 21:51:23] WARNING: [pool freshworks] server reached pm.max_children setting (5), consider raising it

According to PHPINFO this is the php conf:

/etc/php/7.4/fpm/php.ini

And that file has: include=/etc/php/7.4/fpm/pool.d/*.conf

And in both of these files: /etc/php/7.4/fpm/pool.d/www.conf /etc/php/7.4/fpm/pool.d/freshworks.conf

We’ve updated to: pm = ondemand pm.max_children = 40 pm.start_servers = 15 pm.max_spare_servers = 25 pm.max_requests = 600

We’ve restarted but the same errors persist.

What are we missing or overlooking?

Subscribe
Share

Hi @KyleB,

It’s my pleasure! Thank you for getting back, please do keep me in the loop, I’m eager to hear what would be the outcome.

Alrighty, we got this to work. Now we just need to fine-tune the numbers. Thanks for the feedback.


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi @KyleB,

https://www.php.net/manual/en/install.fpm.configuration.php

pm.max_requests:

The number of requests each child process should execute before respawning. This can be useful to work around memory leaks in 3rd party libraries. For endless request processing specify ‘0’. Equivalent to PHP_FCGI_MAX_REQUESTS. Default value: 0.

pm.max_children:

The number of child processes to be created when pm is set to static and the maximum number of child processes to be created when pm is set to dynamic. This option is mandatory.

This option sets the limit on the number of simultaneous requests that will be served. Equivalent to the ApacheMaxClients directive with mpm_prefork and to the PHP_FCGI_CHILDREN environment variable in the original PHP FastCGI.

From the above explanation, it seems you should increase the max_requests a bit.

Additionally, if this pounding of your API is not legit, you should block the IP that’s doing it or is this a legit behavior?