Resolved PHP-fpm max children

Discussion in 'Plesk 12.x for Linux' started by Janko1000, Feb 9, 2016.

  1. Janko1000

    Janko1000 Regular Pleskian

    20
    23%
    Joined:
    Oct 4, 2012
    Messages:
    184
    Likes Received:
    8
    Hi,

    we have 3 "high Traffic" Sites on a Plesk Server.
    The Server has enough Power to handle it but we have Trouble with FPM.

    Code:
    [08-Feb-2016 03:15:08] WARNING: [pool domain.de] server reached max_children setting (5), consider raising it
    [08-Feb-2016 03:15:59] WARNING: [pool domain.de] server reached max_children setting (5), consider raising it
    [08-Feb-2016 03:16:37] WARNING: [pool domain.de] server reached max_children setting (5), consider raising it
    [08-Feb-2016 03:17:45] WARNING: [pool domain.de] server reached max_children setting (5), consider raising it
    [08-Feb-2016 03:38:38] WARNING: [pool domain.de] server reached max_children setting (5), consider raising it
    All Sites are blank at this Time.
    It look like the Value "5" is hardcoded?!
     
  2. IgorG

    IgorG Forums Analyst Plesk Team

    43
    84%
    Joined:
    Oct 27, 2009
    Messages:
    22,949
    Likes Received:
    755
    Location:
    Novosibirsk, Russia
    You can set the value "pm.max_children = 50" on the configuration file of php-fpm. The config file for php-fpm 5.6, for example, is residing in the directory /opt/plesk/php/5.6/etc/php-fpm.d
    You can create or update the above-mentioned value in "www.conf" file under this directory to fix the warning.
    After that restart webserver and php-fpm service.
     
  3. brainforge

    brainforge Basic Pleskian

    20
    40%
    Joined:
    Feb 7, 2011
    Messages:
    55
    Likes Received:
    4
    Location:
    England
    The /opt/plesk/php/5.6/etc/php-fpm.d directory has a .conf file for each domain.
    /opt/plesk/php/5.6/etc/php-fpm.d/domain1.com.conf
    /opt/plesk/php/5.6/etc/php-fpm.d/domain2.com.conf
    Etc.

    Each of these files contains the warning:
    ; DO NOT MODIFY THIS FILE BECAUSE IT WAS GENERATED AUTOMATICALLY,
    ; SO ALL YOUR CHANGES WILL BE LOST THE NEXT TIME THE FILE IS GENERATED.
    ; If you need to customize this file, ... override settings in /var/www/vhosts/system/domain1.com/conf/php.ini ...

    Um, I think this needs a bit more thought and a clearer answer!
     
  4. Michael Huber

    Michael Huber New Pleskian

    5
    20%
    Joined:
    Sep 13, 2014
    Messages:
    14
    Likes Received:
    0
    in my /opt/plesk/php/XX.XX/etc/php-fpm.d/ is no file with www.conf

    there are round about 300 files for each domain. how can I change global this setting and update the domains?

    thanx
     
  5. Enverex

    Enverex New Pleskian

    18
    35%
    Joined:
    Jun 3, 2010
    Messages:
    20
    Likes Received:
    2
    Location:
    UK
    So, is there a way to do this globally yet? 5 per domain by default is painfully low and having to manually create one of these files every time someone makes a domain is obviously unreasonable.
     
  6. UFHH01

    UFHH01 Platinum Pleskian Plesk Guru

    40
    64%
    Joined:
    Jun 11, 2013
    Messages:
    4,919
    Likes Received:
    1,017
    Location:
    Hamburg / Germany
    Hi Michael Huber,
    hi Enverex,


    and
    You might be interested in the "find" - command, in combination with "xargs" and "sed":

    Example commands ( to change "pm.max_children = 5" to "pm.max_children = 50" in *.conf - files at several possible php - paths ):
    Code:
    find /etc/php/ -type f -name *.conf | xargs sed -i "s/pm.max_children = 5/pm.max_children = 50/g"
    
    find /etc/php5/ -type f -name *.conf | xargs sed -i "s/pm.max_children = 5/pm.max_children = 50/g"
    
    find /opt/plesk/php/ -type f -name *.conf | xargs sed -i "s/pm.max_children = 5/pm.max_children = 50/g"

    Check the "pm.max_children" - configuration:

    Examples:
    Code:
    find /etc/php/ -type f -name "*.conf" -exec grep --color -Hni "pm.max_children ="  {} \;
    
    find /etc/php5/ -type f -name "*.conf" -exec grep --color -Hni "pm.max_children ="  {} \;
    
    find /opt/plesk/php/ -type f -name "*.conf" -exec grep --color -Hni "pm.max_children ="  {} \;

    Note:

    A restart of your corresponding PHP-FPM - service(s) is required so that the changes take effect:

    Examples:

    service php5-fpm restart
    service plesk-php54-fpm restart
    service plesk-php71-fpm restart

    ...​
     
  7. Enverex

    Enverex New Pleskian

    18
    35%
    Joined:
    Jun 3, 2010
    Messages:
    20
    Likes Received:
    2
    Location:
    UK
    /etc/php* isn't relevant here as those values aren't used on the "per domain PHP version" type setups.

    The PHP config file /var/www/vhosts/system/(domain)/conf/php.ini is the one that need to be edited, but these don't exist until someone has created that domain.

    In short, we know HOW to raise the value *for a specific domain* but this only allows you to change a single domain and only after it's been created. For people with no access to the filesystem, e.g. a customer, it's not an option.

    Cronjobbing a find/xargs/sed is a dirty hack and far from ideal and having every single customer contact us every single time they add a new domain for us to perform this modification for them is obviously unreasonable.

    My question is - why isn't this just something that can be set in the Plesk panel itself, or even within a domain's own settings? 5 is a very low value and will almost always need to be modified. Modifying this value seems overly difficult for something that you're almost guaranteed to need to modify.
     
  8. UFHH01

    UFHH01 Platinum Pleskian Plesk Guru

    40
    64%
    Joined:
    Jun 11, 2013
    Messages:
    4,919
    Likes Received:
    1,017
    Location:
    Hamburg / Germany
    Hi Enverex,

    Sorry to correct you here, but if you use several additional PHP - versions on your server(s), including the ones from Plesk, it is very relevant - that's why I included these paths as well in my EXAMPLES.

    Again, I'm sorry to correct you: The depending "php.ini" has got nothing to do with the FPM - pool - settings and no modification at a php.ini will result in a change of your corresponding PHP-FPM - setting.

    I suggested the examples to avoid possible manual changes on each existent PHP-FPM - *.conf - file and to save you some time. If you don't want to use the suggestion, pls. feel free to ignore my post. :)


    Actually, this standart setting is inherited from all PHP-version vendors and Plesk meets this standart with the configuration. ;)
     
  9. Enverex

    Enverex New Pleskian

    18
    35%
    Joined:
    Jun 3, 2010
    Messages:
    20
    Likes Received:
    2
    Location:
    UK
    Sorry, ignore my vhost comment, I was referencing the wrong document by accident (I meant the /opt/plesk/php folder, not the vhost PHP override). Anyway...

    Plesk uses /opt/plesk/php/(PHP Version)/etc/php-fpm.d/(Domain).com.conf for the php.ini overrides (nothing in /etc/php gets used unless you use the OS own versions of PHP which isn't relevant in this example).

    Anyway, your response side-steps the actual issues here:

    1. How can we set the default so that domains aren't limited to 5 by default (so that we don't have to retroactively apply the config for domains after they're created).
    2. Why does Plesk not let you set this from within the interface?
     
  10. UFHH01

    UFHH01 Platinum Pleskian Plesk Guru

    40
    64%
    Joined:
    Jun 11, 2013
    Messages:
    4,919
    Likes Received:
    1,017
    Location:
    Hamburg / Germany
    Hi Enverex,

    sorry again, but your answer is again misleading, because you seem to think, that the PHP-FPM - configurations have anything to do with a depending php.ini. This is NOT the case.

    ... and Plesk will as well create a PHP-FPM - configuration to ( for example ) "/etc/php/5.6/fpm/pool.d/(sub)domain.conf", if you desire to choose a vendor PHP-handler ( or possible additional PHP - versions, installed manually on your server - Examples: Multi-PHP - versions from AtomicCorp, or Multi-PHP - versions from Ondřej Surý ) in your (sub)domain - specific PHP - settings. ;)



    To 1: You could consider to modify the corresponding Plesk python "phpinimng", but pls. be aware that you do this on your very own risk and without support from Plesk. In addition, pls. note that all possible changes here might be overwritten in case of updates/upgrades/patches from Plesk at any time.

    To 2: I'm repeating myself here, but the setting here is set to "5", because Plesk meets international standarts for PHP - versions. If you desire an additional feature to overwrite such a standart over the Plesk Control Panel, pls. consider to add a feature request at: => https://plesk.uservoice.com , explain your wishes and don't forget to include your buisiness case in your feature request. :)
     
  11. Enverex

    Enverex New Pleskian

    18
    35%
    Joined:
    Jun 3, 2010
    Messages:
    20
    Likes Received:
    2
    Location:
    UK
    Ok, we may confusing a few things here. Ignore anything about php.ini, all we're discussing here is raising "pm.max_children" globally when using PHP-FPM with Plesk's own multi-PHP version setup, for all domains, be they existing domains or domains that may be added in future. Nothing more. Is there a way of doing that right now?

    Fudging the phpinimng file is obviously not going to be an option as it could break any future updates to Plesk.

    https://plesk.uservoice.com is basically a write-off as this is something we need now or soon, not in several years time (or potentially never). Nothing we've ever requested (or seen others request) that really mattered has ever been implemented, but that's not relevant right now.
     
  12. UFHH01

    UFHH01 Platinum Pleskian Plesk Guru

    40
    64%
    Joined:
    Jun 11, 2013
    Messages:
    4,919
    Likes Received:
    1,017
    Location:
    Hamburg / Germany
    Hi Enverex,

    No, sorry.
     
  13. solucionesuno

    solucionesuno Basic Pleskian

    13
    35%
    Joined:
    Dec 30, 2013
    Messages:
    54
    Likes Received:
    1
  14. gennolo

    gennolo Basic Pleskian

    9
    70%
    Joined:
    Nov 21, 2015
    Messages:
    49
    Likes Received:
    3
  15. IgorG

    IgorG Forums Analyst Plesk Team

    43
    84%
    Joined:
    Oct 27, 2009
    Messages:
    22,949
    Likes Received:
    755
    Location:
    Novosibirsk, Russia
    I think it's unproductive to write "+1" here.
    It would be much more effective to vote for this feature on the Plesk uservoice.
     
    UFHH01 likes this.
Loading...