3

In a Web application with Nginx and PHP-FPM, I've noticed moments of slowness and analyzing the logs, I found this message, which appears from time to time:

[19-Nov-2017 19:24:09] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it

After some reseach, I increased the values in the php.ini configuration file, stopped and removed the php container and rebuild it, for the setting set to a file on a volume had effect.

Analyzing the configuration file inside the container, it's with the new values that I set, however, the error message about pm.max_children (5) continues to appear.

Here is my docker-compose.yml

version: '2'

services:           

    pi_web:
        build: ./nginx
        ports:
            - "80:80"
            - "443:443"

        volumes:
            - ../src:/src
            - ./nginx/conf.d:/etc/nginx/conf.d
            - ./nginx/nginx.conf:/etc/nginx/nginx.conf
            - /etc/letsencrypt:/etc/letsencrypt

    pi_php:
        build: ./php
        volumes:
            - ../src:/src
            - ./php/config/php.ini:/usr/local/etc/php/php.ini

Here is a snippet of the ./php/config/php.ini:

pm = dynamic
pm.max_children = 40
pm.start_servers = 15
pm.min_spare_servers = 15
pm.max_spare_servers = 25

And, if I run:

$ docker exec -it docker_pi_php_1 cat /usr/local/etc/php/php.ini

I see the same values on the snippet above.

The path to the configuration file inside the container is correct, I ran:

$ php --ini 

inside the container and the path is in the list of loaded configuration files.

I've fried my brain trying to get around this problem, but so far I haven't succeeded.

Any ideas?

2

I may be wrong, but assuming you're using the official PHP images those pm settings should be placed inside the /usr/local/etc/php-fpm.d/ directory inside a file with conf extension. According to PHP docs, those settings are FPM related and although they use php.ini syntax, they should be placed in a different file, so I believe that your pm settings are being ignored. This Dockerfile in PHP helped me to find out where are those conf files supposed to be.

I'd check if you have a /usr/local/etc/php-fpm.d/www.conf file inside your container where that max_children is now set to 5. If that is so I guess you could modify your Dockerfile to copy a new www.conf file that sets a higher value for pm.max_children.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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