Optimizing multi php-fpm

Discussion in 'Installation/Configuration' started by kmchen, Mar 21, 2019.

Tags:
  1. kmchen

    kmchen Member

    Hi
    Runing several PHP versions 5.6 and 7.1 on an APACHE 2.4 I can't optimize configuration generated by ISPCONFIG 3.1 for a 16G ram 4 cores server

    When I run apache benchmark (ab -n 3000 -c 200 https://webologix.com/) I see error messages in logs like:

    [pool web3] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 0 idle, and 71 total children
    I tried to rise maxRequestWorkers and pm.max.children from 4 to 7000 and start servers from 2 to 32 without effects. Here are the related files I found:
    # grep MaxRequestWorkers /etc/apache2/mods-enabled/mpm_prefork.conf
    MaxRequestWorkers 7000
    # grep pm.max_children /opt/php-5.6/etc/php-fpm.conf
    pm.max_children = 150
    # cat /opt/php-5.6/etc/php-fpm.d/web3.conf
    pm = dynamic
    pm.max_children = 1750
    pm.start_servers = 32
    pm.min_spare_servers = 4
    pm.max_spare_servers = 64
    pm.max_requests = 1000​

    I can show equivalent parameters for php7.1 with similar errors in logs.

    Are those max workers and children parameters relevant to the error message ?
    Does web3.conf overrides php-fpm.conf for the web3 website ?
    Are these parameters setted somewhere else that I did not see ?

    Looking memory usage with htop during benchmark I see only up to 3G used on 16G available. How can I configure apache/php to use the whole memory ?

    Any advise welcome. Thanks
     
    Last edited: Mar 21, 2019
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    The PHP-FPM settings are on the options tab of the website, do not edit any files directly.
     
  3. kmchen

    kmchen Member

    OK.
    1/ Now I define all pm parameters in ispconfig and I see the webn.conf I was modifying manually modified automatically. Good. But the same errors still appear in logs.

    2 /How do I redirect php-fpm logs to ispconfig/http/website/error.log ?

    3/ Where do I define MaxRequestWorkers ?

    4/ sum of each website parameters = global server value ?
    Let's say the server permits 500 pm.max_children, globaly. With 10 websites, each website max_children should be 50 or can I give up to 500 children each ?
     
    Last edited: Mar 21, 2019
  4. kmchen

    kmchen Member

    Hi, no answer ?
     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    It might be that php-fpm is not able to ramp up the number of childs fast enough to match the number of clients used by your test tool. So the error does not mean that it must occur with real load as well.

    You can probably do that trough the custom php.ini field of the site by specifying a error.log there:

    error_log = /path/to/file

    In the global apache server configuration as described in the apache manual: http://httpd.apache.org/docs/trunk/en/mod/mpm_common.html#maxrequestworkers

    That's per site as you define it per site / fpm pool.
     
  6. kmchen

    kmchen Member

    Thanks a lot till for your reply.

    It's a little confiusing to have to follow regular method with MaxRequestWorkers and ispconfig method for pm_max_children but now I dominate the thing |-)

    Last queston: about 4/ I'm not shure to understand your answer "per site"'. Definition is per site but what pm.max_children for each site ? If n sites, should I give (total apache + php-fpm available memory) / n
    The idea is in case of only one site is runing, can it use the whole free memory of the server ?
     

Share This Page