"server reached max_children setting (5), consider raising it"
If you're having a look through your Servd project logs, you might see this warning a few times:
WARNING: [pool www] server reached max_children setting (5), consider raising it
It originates from php-fpm, a very commonly-used PHP server that utilises multiple concurrent worker processes (or children) to handle requests to your Craft project.
The warning is fired when php-fpm receives a request, but can't immediately fulfil it because it's pool of workers are too busy dealing with other requests. In these scenarios, the request is put on a queue then picked up immediately the next time a worker becomes free.
Like the warning indicates, php-fpm on Servd is configured to use 5 workers. This generally gives a good balance of CPU and memory allowance for each request.
Should I be worried? #
99% of the time, these warnings are normal and are nothing to worry about. Most enqueued requests only remain idle for a few milliseconds, so have minimal overall impact on response times.
If you're seeing them a lot (e.g. hundreds in the space of a few minutes) and are observing a noticeable degradation in response times, then there are a few things worth checking:
- Are you experiencing a sudden influx in traffic? This can often result in the queue filling up faster than the workers can handle.
- Is your project's database or PHP CPU usage at max capacity? This might indicate that some requests are taking a long time to complete, causing the queue to grow.
- Is your queue running a lot of jobs without the dedicated queue runner enabled? This can cause the PHP workers to spend a lot of their time running queue jobs instead of serving requests.
If you're ever at all unsure, feel free to get in contact with us via our support chat. We should be be able to advise on what's causing the warnings to appear.