on Debian 10 when I set pm.max_children = 507
or more and try to start php7.2-fpm I get following error:
-- The unit php7.2-fpm.service has entered the 'failed' state with result 'protocol'. Sep 26 12:07:13 server.local systemd[1]: Failed to start The PHP 7.2 FastCGI Process Manager. -- Subject: A start job for unit php7.2-fpm.service has failed -- Defined-By: systemd -- Support: https://www.debian.org/support -- -- A start job for unit php7.2-fpm.service has finished with a failure.
When I set pm.max_children = 506
or less all is working fine.
My www.pool config:
[www] user = www-data group = www-data listen = /var/run/php7-fpm.sock listen.owner = www-data listen.group = www-data pm = static pm.max_children = 506 pm.max_requests = 1000 catch_workers_output = yes
My server config:
- 10-core CPU
- 256 GB RAM
What can cause that? Is there some hard limit on how much php-fpm children can be started? Or is this some system limit? Can it be increased somehow (I have lot of free memory)?
Advertisement
Answer
Chances are that most of those 500+ php-fpm children will be going unused in the long term, but if you did want to increase the quantity, there are other limits being set by the master-FPM process and the operating system.
Open File Descriptor Limit Set open file descriptor rlimit for the master process. Default value: the rlimit for the master process (from php-fpm.conf).
# in php-fpm.conf and pool.d/*.conf rlimit_files = 131072 # the default value may be as low as 1024, and since each child will typically # open 2 files (stdin & stdout), and there are additional files being used, # 506*2 = 1012 +12 others seems very likely to be an issue.
You may need to also enable php-fpm (or its user) to be able to use more file handles by editing the /etc/security/limits.conf
file, with the hard & soft limits for the user (www-data).