Discover Centmin Mod today
Register Now

Beta Branch add PHP_TUNING variable and phptuning function

Discussion in 'Centmin Mod Github Commits' started by eva2000, Oct 7, 2017.

  1. eva2000

    eva2000 Administrator Staff Member

    35,124
    7,753
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +11,956
    Local Time:
    11:02 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    • Winner Winner x 1
  2. rdan

    rdan Premium Member Premium Member

    4,230
    1,030
    113
    May 25, 2014
    Ratings:
    +1,471
    Local Time:
    9:02 PM
    Mainline
    10.2
    All my servers though uses this formula Eva.
     
    • Informative Informative x 2
  3. eva2000

    eva2000 Administrator Staff Member

    35,124
    7,753
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +11,956
    Local Time:
    11:02 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    Thanks for sharing.. definitely needs more testing hence why it's disabled right now :)
     
    • Like Like x 2
  4. pamamolf

    pamamolf Well-Known Member

    3,111
    295
    83
    May 31, 2014
    Ratings:
    +530
    Local Time:
    4:02 PM
    Nginx-1.13.x
    MariaDB 10.1.x
    I use also dynamic on my servers and a bit higher values than that formula :)

    @Revenge

    may have some nice formula for this as he did also some Dddos tests and maybe knows the limits better ?
     
    Last edited: Oct 8, 2017
  5. rdan

    rdan Premium Member Premium Member

    4,230
    1,030
    113
    May 25, 2014
    Ratings:
    +1,471
    Local Time:
    9:02 PM
    Mainline
    10.2
    If you have a powerful CPU, like having 4ghz clock speed.
    And database server outside localhost.
    It's safe to increase it to:
     
  6. pamamolf

    pamamolf Well-Known Member

    3,111
    295
    83
    May 31, 2014
    Ratings:
    +530
    Local Time:
    4:02 PM
    Nginx-1.13.x
    MariaDB 10.1.x
    My formula looks like:

    Code:
    pm = dynamic
    pm.max_children = cpu x 5
    pm.start_servers = cpu x 2
    pm.min_spare_servers = cpu x 1
    pm.max_spare_servers = cpu x 5
     
  7. pamamolf

    pamamolf Well-Known Member

    3,111
    295
    83
    May 31, 2014
    Ratings:
    +530
    Local Time:
    4:02 PM
    Nginx-1.13.x
    MariaDB 10.1.x
    Also i would like to confirm that if we set PHP_TUNING='y' it will be triggered at:

    1)Php upgrade
    2)Php downgrade
    3)Php upgrade or downgrade and ask YES to overwrite existing phpfpm config
    4)Php upgrade or downgrade and ask NO to overwrite existing phpfpm config

    ?
     
  8. eva2000

    eva2000 Administrator Staff Member

    35,124
    7,753
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +11,956
    Local Time:
    11:02 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    yes if you set PHP_TUNING='y' in persistent config /etc/centminmod/custom_config.inc and recompile php via centmin.sh menu option 5 it should in theory apply to your default php-fpm.conf. It wouldn't apply to any other additional php-fpm pool config files you may have copied or manually made though.

    It doesn't touch pm ondemand default though, you need to manually set that to dynamic if you want such setting.
     
    • Informative Informative x 1
  9. elargento

    elargento Member

    333
    17
    18
    Jan 4, 2016
    Ratings:
    +42
    Local Time:
    10:02 AM
    10
    Guys, where do you take those values from? You monitor your server, change the values and test the use of CPU/memory/disk until you get the best results?
    @pamamolf @RoldanLT
     
  10. rdan

    rdan Premium Member Premium Member

    4,230
    1,030
    113
    May 25, 2014
    Ratings:
    +1,471
    Local Time:
    9:02 PM
    Mainline
    10.2
    Based on years of experience using PHP-FPM.
    Tuning based on the website needs.

    Yes always.

    PHP-FPM mostly matters on CPU only, not much on Memory.
     
  11. elargento

    elargento Member

    333
    17
    18
    Jan 4, 2016
    Ratings:
    +42
    Local Time:
    10:02 AM
    10
    How do you know what your "website needs"?
    I'm currently importing a forum and similar values like yours provided better results (faster import) than pamamolf values.
     
  12. rdan

    rdan Premium Member Premium Member

    4,230
    1,030
    113
    May 25, 2014
    Ratings:
    +1,471
    Local Time:
    9:02 PM
    Mainline
    10.2
    What is your CPU model?
     
  13. rdan

    rdan Premium Member Premium Member

    4,230
    1,030
    113
    May 25, 2014
    Ratings:
    +1,471
    Local Time:
    9:02 PM
    Mainline
    10.2
    To prevent CPU on overloading on heavy PHP-FPM task I'm using this:
    Code:
    pm = dynamic
    pm.max_children = cpu x 3
    pm.start_servers = cpu x 1
    pm.min_spare_servers = cpu / 2
    pm.max_spare_servers = cpu x 2
     
  14. pamamolf

    pamamolf Well-Known Member

    3,111
    295
    83
    May 31, 2014
    Ratings:
    +530
    Local Time:
    4:02 PM
    Nginx-1.13.x
    MariaDB 10.1.x
    I thought that pm.max_spare_servers should be equal to pm.max_children or not?
     
  15. eva2000

    eva2000 Administrator Staff Member

    35,124
    7,753
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +11,956
    Local Time:
    11:02 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    No set rule, use what works for you see PHP: Configuration - Manual
     
  16. pamamolf

    pamamolf Well-Known Member

    3,111
    295
    83
    May 31, 2014
    Ratings:
    +530
    Local Time:
    4:02 PM
    Nginx-1.13.x
    MariaDB 10.1.x
    Ok thanks :)

    That seems confusing to me.....

    Setting for example:
    How many will be available as standby?

    Or is it like the amount of spare servers must be between 5-10 and no more or less?
     
  17. eva2000

    eva2000 Administrator Staff Member

    35,124
    7,753
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +11,956
    Local Time:
    11:02 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    literally read it as 5 min and 10 max :)
     
  18. pamamolf

    pamamolf Well-Known Member

    3,111
    295
    83
    May 31, 2014
    Ratings:
    +530
    Local Time:
    4:02 PM
    Nginx-1.13.x
    MariaDB 10.1.x
    Now i think i got it :)

    So if it goes under 5 it will respawn some and if more than 10 it will kill some....
     
  19. pamamolf

    pamamolf Well-Known Member

    3,111
    295
    83
    May 31, 2014
    Ratings:
    +530
    Local Time:
    4:02 PM
    Nginx-1.13.x
    MariaDB 10.1.x
    @RoldanLT

    What formula do you recommend for a cpu like:

    2X Intel(R) Xeon(R) CPU E5-2640 v3
    32
     
  20. rdan

    rdan Premium Member Premium Member

    4,230
    1,030
    113
    May 25, 2014
    Ratings:
    +1,471
    Local Time:
    9:02 PM
    Mainline
    10.2
    This :).
     
    • Informative Informative x 1
..