Learn about Centmin Mod LEMP Stack 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 at 6:34 AM.

  1. eva2000

    eva2000 Administrator Staff Member

    47,501
    10,779
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,752
    Local Time:
    4:05 PM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    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 Premium Member Premium Member

    5,105
    1,267
    113
    May 25, 2014
    Ratings:
    +1,936
    Local Time:
    2:05 PM
    Mainline
    10.2
    This doesn't apply to pm = static?
    Thanks Eva.
     
  3. eva2000

    eva2000 Administrator Staff Member

    47,501
    10,779
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,752
    Local Time:
    4:05 PM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    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