Join the community today
Register Now

Beta Branch add pm.max_spawn_rate for PHP 8.1 only in 123.09beta01

Discussion in 'Centmin Mod Github Commits' started by eva2000, Nov 26, 2021.

  1. eva2000

    eva2000 Administrator Staff Member

    59,416
    12,521
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,159
    Local Time:
    7:14 PM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    add pm.max_spawn_rate for PHP 8.1 only in 123.09beta01


    - add to /usr/local/etc/php-fpm.conf pm.max_spawn_rate php-fpm directive https://www.php.net/manual/en/migration81.new-features.php#migration81.new-features.fpm for adjustable setting for PHP 8.1 only for initial PHP 8.1 default Centmin Mod installs or for PHP upgrades when you set FPM_MAX_SPAWN_RATE variable value to greater than 32 (default value) in persistent config file /etc/centminmod/custom_config.inc prior to running centmin.sh menu option 5 PHP updates and remove pm.max_spawn_rate directive if PHP <8.1 is detected at centmin.sh menu option 5 PHP update time
    - before PHP 8.1, lower versions had pm.max_spawn_rate directive hard coded and was not end user adjustable. Centmin Mod added option to patch the hard coded value if you set FPM_MAX_SPAWN_RATE variable value to greater than 32 (default hardcoded value) in persistent config file /etc/centminmod/custom_config.inc prior to initial PHP 8.1 default Centmin Mod installs or centmin.sh menu option 5 PHP updates https://community.centminmod.com/th...fpm-fpm_max_spawn_rate-in-123-09beta01.21207/
    - PHP-FPM max spawn rate limits how many additional dynamic PHP-FPM child processes can be spawned every 1 second. This means if you have set PHP-FPM process manager away from Centmin Mod default of pm = ondemand to pm = dynamic in /usr/local/etc/php-fpm.conf so you dynamically spawn PHP-FPM child processes, then it would take 30 seconds total to spawn 920 PHP-FPM child processes accounting for 2x spawn algorithm growth factor. So 1 second 8 additional PHP-FPM child processes spawned, then 2 seconds, 16 additional PHP-FPM child processes spawned, 3 seconds, 32 additional PHP-FPM child processes spawned, 4th second, 32 additional PHP-FPM child processes spawned - all the way to 30 seconds where 920 additional PHP-FPM child processes are spawned.
    - If you try to set pm.max_spawn_rate directive in PHP <8.1, you will not be able to restart PHP-FPM service and journalctl logs would show
    Code (Text):
    journalctl -u php-fpm --no-pager | grep 'pm.max_spawn_rate' | sed -e "s|$HOSTNAME|hostname|g"
    Nov 25 20:55:36 hostname php-fpm[48776]: [25-Nov-2021 20:55:36] ERROR: [/usr/local/etc/php-fpm.conf:73] unknown entry 'pm.max_spawn_rate
    


    Continue reading...

    123.09beta01 branch
     
  2. rdan

    rdan Well-Known Member

    5,452
    1,418
    113
    May 25, 2014
    Ratings:
    +2,212
    Local Time:
    5:14 PM
    Mainline
    10.2
    This doesn't apply to pm = static?
    Thanks Eva.
     
  3. eva2000

    eva2000 Administrator Staff Member

    59,416
    12,521
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,159
    Local Time:
    7:14 PM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    yes only applies to pm = dynamic

    be careful raising pm.max_spawn_rate above default 32 value. If you don't have the server resources i.e. cpu/memory, this can cause much higher cpu/memory usage when you have a very high rate of PHP-FPM related requests