Get the most out of your Centmin Mod LEMP stack
Become a Member

PHP-FPM Multiple PHP-FPM Pools Generator Script testing

Discussion in 'Beta release code' started by eva2000, Aug 2, 2014.

  1. eva2000

    eva2000 Administrator Staff Member

    28,957
    6,573
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,755
    Local Time:
    2:06 AM
    Nginx 1.13.x
    MariaDB 5.5
    Another beta testing item I whipped up. Basically, it's shell script to auto generate as many PHP-FPM pools as you need each with their own dedicated PHP-FPM config file, log files, unix socket and TCP port assigned.

    The TCP port assignment starts at 91xx and auto increments by 01 for each additional PHP-FPM pool. So if you choose to have 2 PHP-FPM pools generated (PHP_POOL=2 variable in phppoolgen.sh), you'd have each PHP-FPM pool on 9100 and 9101 TCP ports respectively. Edit: Ah I need to factor in existing TCP 91XX port detection so if the script is ran a second time, it starts off from last added multi PHP-FPM pool TCP ports.

    The phppoolgen.sh script isn't being released as yet just doing internal testing for now to see how it goes. Wrote the script as it's alot easier to have written it that to explain step by step in manually creating multiple PHP-FPM pools for Centmin Mod Nginx :D

    Once phppoolgen.sh is run a few files are created. Using below output as a specific example.
    1. /root/tools/multiphp_pools/multiphp_pools_info_310714-235154.txt - is a summary file listing each PHP-FPM pools crucial and unique info including where the PHP-FPM config file is for that specific pool i.e. /usr/local/nginx/conf/phpfpmd/multiphp_pool0.conf. Also lists the curl command to pull PHP-FPM stats from.
    2. /root/tools/multiphp_pools/multiphp_pools_stats_cmds_310714-235154.txt - file lists all PHP-FPM pools SSH command to curl grab each PHP-FPM Pools stats. You can use it to run all commands in a shell script to pull all PHP-FPM pools stats all at once.
    3. /usr/local/nginx/conf/multiphp_status.conf - multi PHP-FPM pools php status and ping location contexts. You include this file in main server's hostname Nginx vhost file at /usr/local/nginx/conf/conf.d/virtual.conf. You'd need this along with uncommenting the allow #youripaddress and filling in youripaddress to be able to view your PHP-FPM pool's php status info at http://yourhostname/phpstatus_poolX where X is the PHP-FPM pool number. More PHP status info at PHP-FPM - pm.max_children | Centmin Mod Community
    4. /root/tools/multiphp_pools/cleanup_cmds_310714-235154.sh - the cleanup_cmds_XX.sh shell script. Basically, running it removes all created multi PHP-FPM pools and reverts your environment as close to previous state as possible. Still manual steps involved to change back /usr/local/nginx/conf/php.conf include file's fastcgi_pass value to 127.0.0.1:9000.
    5. /usr/local/nginx/conf/multiphp_upstream.conf - the include file for the PHP-FPM pool upstream load balanced backend named multiphp_backend. This needs to be included in /usr/local/nginx/conf/nginx.conf after the http { for you to be able to use the multiple PHP-FPM pools in load balanced configuration.
    6. /usr/local/nginx/conf/phpfpmd/ - is the directory where the multiple PHP-FPM config *.conf files are located
    phppoolgen.sh variables
    Code:
    PHP_POOLS='2'
    
    # Default values for pm.max_children and pm.max_requests
    # info at https://community.centminmod.com/threads/pm-max_children.479/#post-2036
    # PM_MODE choices are ondemand, static or dynamic
    # for multi PHP pools set static
    PM_MODE='static'
    PHP_MAXCHILDREN='4'
    PHP_MAXREQUESTS='2000'
    
    # default PHP-FPM pool user and group
    # default is nginx:nginx for user:group
    # if changing user/group, the user and group must
    # already exist first
    PHP_USER='nginx'
    PHP_GROUP='nginx'
    Code:
    ./phppoolgen.sh
    
    -----------------------------------------------------------------------
    created summary multi PHP-FPM pool info file at:
    /root/tools/multiphp_pools/multiphp_pools_info_310714-235154.txt
    
    Thu Jul 31 23:51:54 UTC 2014
    ####################################
    Summary for php_pool0 pool:
    ####################################
    File location = /usr/local/nginx/conf/phpfpmd/multiphp_pool0.conf
    
    SSH command to view php_pool0 pool stats
    curl --silent --connect-timeout 5 --max-time 5 127.0.0.1/phpstatus_pool0
    
    [php_pool0]
    PHP_PORT=9100
    listen = 127.0.0.1:9100
    ;listen = /tmp/multi_php-fpm0.sock
    slowlog = /var/log/php-fpm/multiphp-slow0.log
    pm.status_path = /phpstatus_pool0
    ping.path = /phpping_pool0
    /var/log/php-fpm/multiphp.error0.log
    
    ####################################
    Summary for php_pool1 pool:
    ####################################
    File location = /usr/local/nginx/conf/phpfpmd/multiphp_pool1.conf
    
    SSH command to view php_pool1 pool stats
    curl --silent --connect-timeout 5 --max-time 5 127.0.0.1/phpstatus_pool1
    
    [php_pool1]
    PHP_PORT=9101
    listen = 127.0.0.1:9101
    ;listen = /tmp/multi_php-fpm1.sock
    slowlog = /var/log/php-fpm/multiphp-slow1.log
    pm.status_path = /phpstatus_pool1
    ping.path = /phpping_pool1
    /var/log/php-fpm/multiphp.error1.log
    
    
    -----------------------------------------------------------------------
    created php status SSH cmds list file at:
    /root/tools/multiphp_pools/multiphp_pools_stats_cmds_310714-235154.txt
    
    curl --silent --connect-timeout 5 --max-time 5 127.0.0.1/phpstatus_pool0
    curl --silent --connect-timeout 5 --max-time 5 127.0.0.1/phpstatus_pool1
    
    -----------------------------------------------------------------------
    created phpstatus config file at:
    /usr/local/nginx/conf/multiphp_status.conf
    
    Thu Jul 31 23:51:54 UTC 2014
    location ~ ^/(phpstatus_pool0|/phpping_pool0)$ {
        access_log       off;
        #fastcgi_pass    unix:/tmp/multi_php-fpm0.sock;
        fastcgi_pass     127.0.0.1:9100;
        fastcgi_param    SCRIPT_FILENAME ;
        include          fastcgi_params;
        allow  127.0.0.1;
        #allow yourstaticipaddress;
        deny    all;
    }
    
    location ~ ^/(phpstatus_pool1|/phpping_pool1)$ {
        access_log       off;
        #fastcgi_pass    unix:/tmp/multi_php-fpm1.sock;
        fastcgi_pass     127.0.0.1:9101;
        fastcgi_param    SCRIPT_FILENAME ;
        include          fastcgi_params;
        allow  127.0.0.1;
        #allow yourstaticipaddress;
        deny    all;
    }
    
    
    -----------------------------------------------------------------------
    created cleanup_cmds_310714-235154.sh script at:
    /root/tools/multiphp_pools/cleanup_cmds_310714-235154.sh
    
    #!/bin/bash
    rm -rf /usr/local/nginx/conf/multiphp_upstream.conf
    rm -rf /usr/local/nginx/conf/multiphp_status.conf
    #rm -rf /root/tools/multiphp_pools/multiphp_pools_info_310714-235154.txt
    #rm -rf /root/tools/multiphp_pools/multiphp_pools_stats_cmds_310714-235154.txt
    rm -rf /usr/local/nginx/conf/phpfpmd/multiphp_pool0.conf
    rm -rf /var/log/php-fpm/multiphp-slow0.log
    rm -rf /var/log/php-fpm/multiphp.error0.log
    rm -rf /usr/local/nginx/conf/phpfpmd/multiphp_pool1.conf
    rm -rf /var/log/php-fpm/multiphp-slow1.log
    rm -rf /var/log/php-fpm/multiphp.error1.log
    
    -----------------------------------------------------------------------
    created php backup upstream file at:
    /usr/local/nginx/conf/multiphp_upstream.conf
    
    upstream multiphp_backend {
    ip_hash;
    keepalive 16;
    server 127.0.0.1:9100 weight=10 max_fails=5 fail_timeout=10;
    server 127.0.0.1:9101 weight=10 max_fails=5 fail_timeout=10;
    }
    
    -----------------------------------------------------------------------
    created 2 PHP-FPM pool config files
    in directory /usr/local/nginx/conf/phpfpmd/
    total 16K
    drwxr-xr-x 2 root root 4.0K Jul 31 23:51 .
    drwxr-xr-x 5 root root 4.0K Jul 31 23:51 ..
    -rw-r--r-- 1 root root 1.6K Jul 31 23:51 multiphp_pool0.conf
    -rw-r--r-- 1 root root 1.6K Jul 31 23:51 multiphp_pool1.conf
    
    -----------------------------------------------------------------------
    edit /usr/local/nginx/conf/nginx.conf and add include file
    /usr/local/nginx/conf/multiphp_upstream.conf
    
    below and after http {
    
    http {
    include /usr/local/nginx/conf/multiphp_upstream.conf;
    
    -----------------------------------------------------------------------
    edit /usr/local/nginx/conf/conf.d/virtual.conf and add include file
    /usr/local/nginx/conf/multiphp_status.conf
    
    below existing include files so looks like
    
    include /usr/local/nginx/conf/staticfiles.conf;
    include /usr/local/nginx/conf/php.conf;
    #include /usr/local/nginx/conf/phpstatus.conf;
    include /usr/local/nginx/conf/drop.conf;
    #include /usr/local/nginx/conf/errorpage.conf;
    include /usr/local/nginx/conf/multiphp_status.conf;
    
    -----------------------------------------------------------------------
    edit /usr/local/nginx/conf/php.conf include file and change fastcgi_pass
    value 127.0.0.1:9000 to use multiphp_backend defined
    in /usr/local/nginx/conf/multiphp_upstream.conf
    
    fastcgi_pass   127.0.0.1:9000;
    
      becomes
    
    fastcgi_pass   multiphp_backend;
    
    -----------------------------------------------------------------------
    edit /usr/local/etc/php-fpm.conf and uncomment this line
    
    from
    
    ;include=/usr/local/nginx/conf/phpfpmd/*.conf
    
    becomes
    
    include=/usr/local/nginx/conf/phpfpmd/*.conf
    
    -----------------------------------------------------------------------
    restart both nginx and php-rpm for changes to take effect
    command shortcut = nprestart
    
    -----------------------------------------------------------------------
    to remove all created multi PHP-FPM pool files and revert to previous
    state, revert change in /usr/local/nginx/conf/php.conf and run cleanup script
    at: /root/tools/multiphp_pools/cleanup_cmds_310714-235154.sh
    sample contents from /usr/local/nginx/conf/phpfpmd/multiphp_pool0.conf
    Code:
    [php_pool0]
    user = nginx
    group = nginx
    
    listen = 127.0.0.1:9100
    ;listen.allowed_clients = 127.0.0.1
    ;listen.backlog = -1
    listen.backlog = 131072
    
    ;listen = /tmp/multi_php-fpm0.sock
    listen.owner = nginx
    listen.group = nginx
    listen.mode = 0666
    
    pm = static
    pm.max_children = 4
    ; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
    pm.start_servers = 1
    pm.min_spare_servers = 1
    pm.max_spare_servers = 3
    pm.max_requests = 2000
    
    rlimit_files = 131072
    rlimit_core = 0
    
    ; The timeout for serving a single request after which the worker process will
    ; be killed. This option should be used when the 'max_execution_time' ini option
    ; does not stop script execution for some reason. A value of '0' means 'off'.
    ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
    ; Default Value: 0
    ;request_terminate_timeout = 0
    ; Default Value: 0
    ;request_slowlog_timeout = 0
    slowlog = /var/log/php-fpm/multiphp-slow0.log
    
    pm.status_path = /phpstatus_pool0
    ping.path = /phpping_pool0
    ping.response = pong
    
    ; Limits the extensions of the main script FPM will allow to parse. This can
    ; prevent configuration mistakes on the web server side. You should only limit
    ; FPM to .php extensions to prevent malicious users to use other extensions to
    ; exectute php code.
    ; Note: set an empty value to allow all extensions.
    ; Default Value: .php
    security.limit_extensions = .php .php3 .php4 .php5
    
    ; catch_workers_output = yes
    php_admin_value[error_log] = /var/log/php-fpm/multiphp.error0.log
    php_admin_value[disable_functions] = shell_exec
    
     
    Last edited: Aug 2, 2014
    • Like Like x 2
  2. eva2000

    eva2000 Administrator Staff Member

    28,957
    6,573
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,755
    Local Time:
    2:06 AM
    Nginx 1.13.x
    MariaDB 5.5
    multiple PHP-FPM pools in action on this very forum :D

    of course I had to manually do this as script didn't exist at the time :)

    [​IMG]
     
    • Like Like x 1
  3. RoldanLT

    RoldanLT Well-Known Member

    3,828
    929
    113
    May 25, 2014
    Phillipines
    Ratings:
    +1,258
    Local Time:
    12:06 AM
    1.11
    10.2
    I LOVE YOU! :D
     
  4. eva2000

    eva2000 Administrator Staff Member

    28,957
    6,573
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,755
    Local Time:
    2:06 AM
    Nginx 1.13.x
    MariaDB 5.5
    I thought you'd like this :)
     
    • Like Like x 1
  5. RoldanLT

    RoldanLT Well-Known Member

    3,828
    929
    113
    May 25, 2014
    Phillipines
    Ratings:
    +1,258
    Local Time:
    12:06 AM
    1.11
    10.2
    Last edited by a moderator: Aug 2, 2014
  6. eva2000

    eva2000 Administrator Staff Member

    28,957
    6,573
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,755
    Local Time:
    2:06 AM
    Nginx 1.13.x
    MariaDB 5.5
  7. RoldanLT

    RoldanLT Well-Known Member

    3,828
    929
    113
    May 25, 2014
    Phillipines
    Ratings:
    +1,258
    Local Time:
    12:06 AM
    1.11
    10.2
    I mean, if you already release that bash script on 1st post, and I can already use multiple pools on my forum maybe it can help ;)
     
  8. eva2000

    eva2000 Administrator Staff Member

    28,957
    6,573
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,755
    Local Time:
    2:06 AM
    Nginx 1.13.x
    MariaDB 5.5
    Well depending on where the PHP-FPM load is for you, you'd probably still hit the same limits I suspect of which again you'd need to follow advice in my replies at PHP-FPM - WARNING: [pool www] server reached max_children setting (50), consider raising it | Centmin Mod Community to get to the bottom of. Either way, you'll eventually have to do what I outline in that thread - no avoiding it (trial and error tune/testing and log analysis) :) For example, to tune my 8 PHP-FPM pools for this forum, I tried around 80 setting combinations and 200 load test runs on the forum while analysing logs and server stats :)

    From my exclusive for this forum use only multi PHP-FPM pool stats script - emails me reports of the status and state of all PHP-FPM pools for the forums and also reloads PHP-FPM services when PHP-FPM pools become unresponsive (not down as PHP-FPM processes can still be up and running but non-responsive to new connections too).

    Code:
    PHP-FPM pools status: ok
    
    start since avg: 362367.00
    accepted conn avg: 8819.50
    listen queue avg: 21844.38
    max listen avg: 41.12
    listen queue len avg: 65492.00
    idle processes avg: 3.12
    active processes avg: 4.81
    total processes avg: 6.38
    max active processes avg: 6.38
    max children reached avg: 0.00
    slow requests avg: 0.00
    
    ###################################################
    pool:                 www
    process manager:      static
    start time:           27/Jul/2014:16:10:35 +0000
    start since:          362368
    accepted conn:        8605
    listen queue:         0
    max listen queue:     13
    listen queue len:     65492
    idle processes:       3
    active processes:     5
    total processes:      8
    max active processes: 8
    max children reached: 0
    slow requests:        0
    200
    ###################################################
    pool:                 www2
    process manager:      static
    start time:           27/Jul/2014:16:10:35 +0000
    start since:          362368
    accepted conn:        8780
    listen queue:         0
    max listen queue:     59
    listen queue len:     65492
    idle processes:       3
    active processes:     3
    total processes:      6
    max active processes: 6
    max children reached: 0
    slow requests:        0
    200
    ###################################################
    pool:                 www3
    process manager:      static
    start time:           27/Jul/2014:16:10:35 +0000
    start since:          362368
    accepted conn:        8604
    listen queue:         0
    max listen queue:     17
    listen queue len:     65492
    idle processes:       1
    active processes:     5
    total processes:      6
    max active processes: 6
    max children reached: 0
    slow requests:        0
    200
    ###################################################
    pool:                 www4
    process manager:      static
    start time:           27/Jul/2014:16:10:35 +0000
    start since:          362368
    accepted conn:        9607
    listen queue:         0
    max listen queue:     1
    listen queue len:     65492
    idle processes:       5
    active processes:     3
    total processes:      8
    max active processes: 8
    max children reached: 0
    slow requests:        0
    200
    ###################################################
    pool:                 www5
    process manager:      static
    start time:           27/Jul/2014:16:10:35 +0000
    start since:          362368
    accepted conn:        8573
    listen queue:         0
    max listen queue:     101
    listen queue len:     65492
    idle processes:       3
    active processes:     2
    total processes:      5
    max active processes: 5
    max children reached: 0
    slow requests:        0
    200
    ###################################################
    pool:                 www6
    process manager:      static
    start time:           27/Jul/2014:16:10:35 +0000
    start since:          362368
    accepted conn:        8561
    listen queue:         0
    max listen queue:     52
    listen queue len:     65492
    idle processes:       3
    active processes:     3
    total processes:      6
    max active processes: 6
    max children reached: 0
    slow requests:        0
    200
    ###################################################
    pool:                 www7
    process manager:      static
    start time:           27/Jul/2014:16:10:35 +0000
    start since:          362368
    accepted conn:        8623
    listen queue:         0
    max listen queue:     72
    listen queue len:     65492
    idle processes:       3
    active processes:     3
    total processes:      6
    max active processes: 6
    max children reached: 0
    slow requests:        0
    200
    ###################################################
    pool:                 www8
    process manager:      static
    start time:           27/Jul/2014:16:10:35 +0000
    start since:          362368
    accepted conn:        9283
    listen queue:         0
    max listen queue:     14
    listen queue len:     65492
    idle processes:       4
    active processes:     2
    total processes:      6
    max active processes: 6
    max children reached: 0
    slow requests:        0
    200
    When this forum's PHP-FPM loads increase in future, then it's another set of trial and error test/tuning on the books - that's how it is constant monitoring and re-tuning :D ;) That's the weakness of PHP-FPM with Nginx. LiteSpeed Enterprise and OpenLiteSpeed web server's LSAPI PHP implementation scales much better for heavy concurrent non-cached PHP loads.
     
    Last edited: Aug 2, 2014
    • Like Like x 1
  9. eva2000

    eva2000 Administrator Staff Member

    28,957
    6,573
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,755
    Local Time:
    2:06 AM
    Nginx 1.13.x
    MariaDB 5.5
    Roughly got existing multi PHP-FPM pool detection working, I ran the script 2 more times back to end from the first initial run with PHP_POOLS=2. So 2 more script runs should result in a total of 3x2 = 6x PHP-FPM pools created with TCP ports from 9100-9106. Also added DEBUG mode to output some calculations while working it out. Detected existing multi PHP-FPM pools will auto increment both TCP ports and the PHP_POOLS defined value on the fly.

    Code:
    ./phppoolgen.sh
    4 is => 1
    5
    new PHP_POOLS=7
    05
    9105
    multiphp_pools_info_020814-132012.txt
    CHECKRUNPORT is empty: 5
    
    -----------------------------------------------------------------------
    created summary multi PHP-FPM pool info file at:
    /root/tools/multiphp_pools/multiphp_pools_info_020814-133943.txt
    
    Sat Aug 2 13:39:43 UTC 2014
    ####################################
    Summary for php_pool5 pool:
    ####################################
    File location = /usr/local/nginx/conf/phpfpmd/multiphp_pool5.conf
    
    SSH command to view php_pool5 pool stats
    curl --silent --connect-timeout 5 --max-time 5 127.0.0.1/phpstatus_pool5
    
    [php_pool5]
    PHP_PORT=9105
    listen = 127.0.0.1:9105
    ;listen = /tmp/multi_php-fpm5.sock
    slowlog = /var/log/php-fpm/multiphp-slow5.log
    pm.status_path = /phpstatus_pool5
    ping.path = /phpping_pool5
    /var/log/php-fpm/multiphp.error5.log
    
    ####################################
    Summary for php_pool6 pool:
    ####################################
    File location = /usr/local/nginx/conf/phpfpmd/multiphp_pool6.conf
    
    SSH command to view php_pool6 pool stats
    curl --silent --connect-timeout 5 --max-time 5 127.0.0.1/phpstatus_pool6
    
    [php_pool6]
    PHP_PORT=9106
    listen = 127.0.0.1:9106
    ;listen = /tmp/multi_php-fpm6.sock
    slowlog = /var/log/php-fpm/multiphp-slow6.log
    pm.status_path = /phpstatus_pool6
    ping.path = /phpping_pool6
    /var/log/php-fpm/multiphp.error6.log
    
    
    -----------------------------------------------------------------------
    created php status SSH cmds list file at:
    /root/tools/multiphp_pools/multiphp_pools_stats_cmds_020814-133943.txt
    
    curl --silent --connect-timeout 5 --max-time 5 127.0.0.1/phpstatus_pool5
    curl --silent --connect-timeout 5 --max-time 5 127.0.0.1/phpstatus_pool6
    
    -----------------------------------------------------------------------
    created phpstatus config file at:
    /usr/local/nginx/conf/multiphp_status.conf
    
    location ~ ^/(phpstatus_pool0|/phpping_pool0)$ {
        access_log       off;
        #fastcgi_pass    unix:/tmp/multi_php-fpm0.sock;
        fastcgi_pass     127.0.0.1:9100;
        fastcgi_param    SCRIPT_FILENAME ;
        include          fastcgi_params;
        allow  127.0.0.1;
        #allow yourstaticipaddress;
        deny    all;
    }
    
    location ~ ^/(phpstatus_pool1|/phpping_pool1)$ {
        access_log       off;
        #fastcgi_pass    unix:/tmp/multi_php-fpm1.sock;
        fastcgi_pass     127.0.0.1:9101;
        fastcgi_param    SCRIPT_FILENAME ;
        include          fastcgi_params;
        allow  127.0.0.1;
        #allow yourstaticipaddress;
        deny    all;
    }
    
    location ~ ^/(phpstatus_pool3|/phpping_pool3)$ {
        access_log       off;
        #fastcgi_pass    unix:/tmp/multi_php-fpm3.sock;
        fastcgi_pass     127.0.0.1:9103;
        fastcgi_param    SCRIPT_FILENAME ;
        include          fastcgi_params;
        allow  127.0.0.1;
        #allow yourstaticipaddress;
        deny    all;
    }
    
    location ~ ^/(phpstatus_pool4|/phpping_pool4)$ {
        access_log       off;
        #fastcgi_pass    unix:/tmp/multi_php-fpm4.sock;
        fastcgi_pass     127.0.0.1:9104;
        fastcgi_param    SCRIPT_FILENAME ;
        include          fastcgi_params;
        allow  127.0.0.1;
        #allow yourstaticipaddress;
        deny    all;
    }
    
    location ~ ^/(phpstatus_pool5|/phpping_pool5)$ {
        access_log       off;
        #fastcgi_pass    unix:/tmp/multi_php-fpm5.sock;
        fastcgi_pass     127.0.0.1:9105;
        fastcgi_param    SCRIPT_FILENAME ;
        include          fastcgi_params;
        allow  127.0.0.1;
        #allow yourstaticipaddress;
        deny    all;
    }
    
    location ~ ^/(phpstatus_pool6|/phpping_pool6)$ {
        access_log       off;
        #fastcgi_pass    unix:/tmp/multi_php-fpm6.sock;
        fastcgi_pass     127.0.0.1:9106;
        fastcgi_param    SCRIPT_FILENAME ;
        include          fastcgi_params;
        allow  127.0.0.1;
        #allow yourstaticipaddress;
        deny    all;
    }
    
    
    -----------------------------------------------------------------------
    created cleanup_cmds_020814-133943.sh script at:
    /root/tools/multiphp_pools/cleanup_cmds_020814-133943.sh
    
    #!/bin/bash
    rm -rf /usr/local/nginx/conf/multiphp_upstream.conf
    rm -rf /usr/local/nginx/conf/multiphp_status.conf
    #rm -rf /root/tools/multiphp_pools/multiphp_pools_info_020814-133943.txt
    #rm -rf /root/tools/multiphp_pools/multiphp_pools_stats_cmds_020814-133943.txt
    rm -rf /usr/local/nginx/conf/phpfpmd/multiphp_pool5.conf
    rm -rf /var/log/php-fpm/multiphp-slow5.log
    rm -rf /var/log/php-fpm/multiphp.error5.log
    rm -rf /usr/local/nginx/conf/phpfpmd/multiphp_pool6.conf
    rm -rf /var/log/php-fpm/multiphp-slow6.log
    rm -rf /var/log/php-fpm/multiphp.error6.log
    
    -----------------------------------------------------------------------
    created php backup upstream file at:
    /usr/local/nginx/conf/multiphp_upstream.conf
    
    upstream multiphp_backend {
    ip_hash;
    keepalive 16;
    server 127.0.0.1:9105 weight=10 max_fails=5 fail_timeout=10;
    server 127.0.0.1:9106 weight=10 max_fails=5 fail_timeout=10;
    }
    
    -----------------------------------------------------------------------
    created 7 PHP-FPM pool config files
    in directory /usr/local/nginx/conf/phpfpmd/
    total 32K
    drwxr-xr-x 2 root root 4.0K Aug  2 13:39 .
    drwxr-xr-x 5 root root 4.0K Aug  2 13:20 ..
    -rw-r--r-- 1 root root 1.6K Aug  2 13:20 multiphp_pool0.conf
    -rw-r--r-- 1 root root 1.6K Aug  2 13:20 multiphp_pool1.conf
    -rw-r--r-- 1 root root 1.6K Aug  2 13:39 multiphp_pool3.conf
    -rw-r--r-- 1 root root 1.6K Aug  2 13:39 multiphp_pool4.conf
    -rw-r--r-- 1 root root 1.6K Aug  2 13:39 multiphp_pool5.conf
    -rw-r--r-- 1 root root 1.6K Aug  2 13:39 multiphp_pool6.conf
    
    -----------------------------------------------------------------------
    edit /usr/local/nginx/conf/nginx.conf and add include file
    /usr/local/nginx/conf/multiphp_upstream.conf
    
    below and after http {
    
    http {
    include /usr/local/nginx/conf/multiphp_upstream.conf;
    
    
    -----------------------------------------------------------------------
    edit /usr/local/nginx/conf/conf.d/virtual.conf and add include file
    /usr/local/nginx/conf/multiphp_status.conf
    
    below existing include files so looks like
    
    include /usr/local/nginx/conf/staticfiles.conf;
    include /usr/local/nginx/conf/php.conf;
    #include /usr/local/nginx/conf/phpstatus.conf;
    include /usr/local/nginx/conf/drop.conf;
    #include /usr/local/nginx/conf/errorpage.conf;
    include /usr/local/nginx/conf/multiphp_status.conf;
    
    
    
    -----------------------------------------------------------------------
    edit /usr/local/nginx/conf/php.conf include file and change fastcgi_pass
    value 127.0.0.1:9000 to use multiphp_backend defined
    in /usr/local/nginx/conf/multiphp_upstream.conf
    
    fastcgi_pass   127.0.0.1:9000;
    
      becomes
    
    fastcgi_pass   multiphp_backend;
    
    
    -----------------------------------------------------------------------
    edit /usr/local/etc/php-fpm.conf and uncomment this line
    
    from
    
    ;include=/usr/local/nginx/conf/phpfpmd/*.conf
    
    becomes
    
    include=/usr/local/nginx/conf/phpfpmd/*.conf
    
    -----------------------------------------------------------------------
    restart both nginx and php-rpm for changes to take effect
    command shortcut = nprestart
    
    -----------------------------------------------------------------------
    to remove all created multi PHP-FPM pool files and revert to previous
    state, revert change in /usr/local/nginx/conf/php.conf and run cleanup script
    at: /root/tools/multiphp_pools/cleanup_cmds_020814-133943.sh
    
    -----------------------------------------------------------------------
    Detected that existing additional PHP-FPM pools exist
    in /usr/local/nginx/conf/phpfpmd/ directory so you would needed
    to manually adjust /usr/local/nginx/conf/multiphp_upstream.conf
    and /usr/local/nginx/conf/multiphp_status.conf to account
    for those additional multi PHP-FPM pools
    
    You can find previously created multi PHP-FPM pool summary text
    file at /root/tools/multiphp_pools/multiphp_pools_info_*.txt
     
    • Like Like x 1
  10. hungphutho

    hungphutho Member

    55
    35
    18
    Jun 2, 2014
    Ratings:
    +35
    Local Time:
    11:06 PM
    1.7.2
    Percona 5.6
    Me that have testing :D
    php_fpm_time-day.png
     
    • Like Like x 1
  11. eva2000

    eva2000 Administrator Staff Member

    28,957
    6,573
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,755
    Local Time:
    2:06 AM
    Nginx 1.13.x
    MariaDB 5.5
    Ah I see you manually setup additional pools :)
     
  12. GhoHan

    GhoHan Member

    32
    13
    8
    Jun 1, 2014
    Ratings:
    +13
    Local Time:
    11:06 PM
    1.7.X
    10.X
    Multiple PHP-FPM Pools (y)(y)(y)(y)(y)
     
  13. eva2000

    eva2000 Administrator Staff Member

    28,957
    6,573
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,755
    Local Time:
    2:06 AM
    Nginx 1.13.x
    MariaDB 5.5
    Yes Premium User Members already get early access to above multiple PHP-FPM pool generator script in the private Premium user only forums (other benefits outlined)