Azure PHP App Service - Change pm.max_children setting

Alec Dhuse 1 Reputation point

I'm seeing in the logs for my PHP app service the following message:

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

From doing a but of searching it seems like having the max_children value at 5 is pretty low. It seems the default for most PHP installations is 20. Is there a way to change this number with in the app service?


Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,985 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Grmacjon-MSFT 16,441 Reputation points

    Hi @Alec Dhuse ,

    Thanks for the question. You're correct the default max_children setting is 20. what version of PHP are you using?

    Based on the solution found here, "you need to find your php-fpm.conf or www.conf depending on what version of PHP-FPM you have installed. for example edit /etc/php/7.0/fpm/pool.d/www.conf. You’ll want to look for the following settings and make adjustments based on your server specs:

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

    Depending on the name of your service, you can try on of the following:

    sudo systemctl restart php-fpm  
    sudo systemctl restart php7.0-fpm  

    the following command will help us to determine the memory used by each (PHP-FPM) child process:

    ps -ylC php-fpm --sort:rss  

    You can check an average memory usage by single PHP-FPM process with this command:

    ps --no-headers -o "rss,cmd" -C php-fpm | awk '{ sum+=$1 } END { printf ("%d%s\n", sum/NR/1024,"M") }'  

    Hope that helps. Please let us know if you have further questions.



    --If the reply is helpful, please Upvote and Accept as answer--

  2. Nibbler 616 Reputation points


    Do you have feedback in regards this being PHP 8 and not 7 as used in your example

    Also, any idea about my question regarding the teir in scope, what amount of request one should in theory expect a P1v3 app should be able to handle?

    0 comments No comments

  3. riccardo 1 Reputation point

    As of now (september 23) the proper way is to set the FPM_* configuration variables understood by Oryx, see here. Be careful: invalid configurations (for example setting FPM_MIN_SPARE_SERVERS greater than FPM_MAX_CHILDREN) will result in a startup failure of the php-fpm pseudo service.

    Overriding the www.conf configuration file of the default WWW pool is futile: at startup, AppService will just override it silently. Rehashing (i.e. kill -HUP) the PHP-FPM daemonized process is also wrong (it will just crash the webapp).

    Should you need more customization, e.g. a more specific www.conf you are advised to bake your own Docker image and deploy that.

    0 comments No comments