Want to subscribe to topics you're interested in?
Become a Member

Beta Branch prep for PHP-FPM pools 2 to 5 support

Discussion in 'Centmin Mod Github Commits' started by eva2000, Jun 25, 2015.

  1. rdan

    rdan Well-Known Member

    4,983
    1,185
    113
    May 25, 2014
    Ratings:
    +1,804
    Local Time:
    11:40 AM
    Mainline
    10.2
    I have fully working setup Nginx/PHP-FPM-Unix socket-Multiple Pools, OLS/PHP-LSAPI, MariaDB 10 on my Ubuntu Desktop and can even deploy it on Live Ubuntu Server... But, I still want to stick with Centminmod :)
    To explore each added features you may add from time to time :)
     
  2. pamamolf

    pamamolf Premium Member Premium Member

    3,842
    377
    83
    May 31, 2014
    Ratings:
    +722
    Local Time:
    6:40 AM
    Nginx-1.17.x
    MariaDB 10.3.x
    I was thinking that it will perform better with multiple pools for a high traffic site but now i am thinking to try it as it was not work for you well :(
     
  3. rdan

    rdan Well-Known Member

    4,983
    1,185
    113
    May 25, 2014
    Ratings:
    +1,804
    Local Time:
    11:40 AM
    Mainline
    10.2
    Don't hesitate to try it :)
    Maybe it's just Linode having 2.8ghz CPU and I only have 12 cpu core.
     
  4. pamamolf

    pamamolf Premium Member Premium Member

    3,842
    377
    83
    May 31, 2014
    Ratings:
    +722
    Local Time:
    6:40 AM
    Nginx-1.17.x
    MariaDB 10.3.x
    Your hardware seems fine to use multiple pools for me.....

    You should try to use X3 your phpfpm settings as are low i think.....

    They will not kill your server...
     
  5. rdan

    rdan Well-Known Member

    4,983
    1,185
    113
    May 25, 2014
    Ratings:
    +1,804
    Local Time:
    11:40 AM
    Mainline
    10.2
    The current config I'm using is very fine already:)
    I didn't even reach the max_children, so why increasing it? :)
     
  6. pamamolf

    pamamolf Premium Member Premium Member

    3,842
    377
    83
    May 31, 2014
    Ratings:
    +722
    Local Time:
    6:40 AM
    Nginx-1.17.x
    MariaDB 10.3.x
    I thought that your problem was max children as it is low and that's why your site was slow that's why i recommend you to increase it.....

    But if you didn't reach it then maybe something else is the problem but in theory it should work faster and better the multiple pools....
     
  7. pamamolf

    pamamolf Premium Member Premium Member

    3,842
    377
    83
    May 31, 2014
    Ratings:
    +722
    Local Time:
    6:40 AM
    Nginx-1.17.x
    MariaDB 10.3.x
    I just download latest beta version and run once ./centmin.sh and i enable the multiple pols and all working great.

    But i am getting this:

    Code:
    [root@server ~]# fpmconf-2
    -bash: fpmconf-2: command not found
    The file exist as i edited after that manually...
     
  8. Revenge

    Revenge Active Member

    456
    93
    28
    Feb 21, 2016
    Portugal
    Ratings:
    +347
    Local Time:
    4:40 AM
    1.9.x
    10.1.x
    I configured Multiple PHP-FPM pool's in two of my servers. I have seen performance improvements in both of them, specially if someone hammers the site with lots of requests, it will use only one of the pools because of the ip_hash parameter.

    One of them went from a Pool with 30 children's, to 4 pools with 8 children each.
    The other went from a pool with 100 children's, to 8 pools with 15 children each.
     
  9. negative

    negative Active Member

    406
    49
    28
    Apr 11, 2015
    Ratings:
    +96
    Local Time:
    6:40 AM
    1.9.10
    10.1.11
    I'm using the fpm pools up to 5 too.

    But i'm still using tcp ip, not unix sockets.
    I read a review of @eva2000 and i see that he still prefer the tcp ip sockets after his performance tests.

    What about the latest news about that ? (unix sockets vs tcp while using the phpfpm pools )
     
  10. Revenge

    Revenge Active Member

    456
    93
    28
    Feb 21, 2016
    Portugal
    Ratings:
    +347
    Local Time:
    4:40 AM
    1.9.x
    10.1.x
    I always used TCP. It scales better than unix sockets, so its better for sites with lot of concurrent requests..
     
  11. negative

    negative Active Member

    406
    49
    28
    Apr 11, 2015
    Ratings:
    +96
    Local Time:
    6:40 AM
    1.9.10
    10.1.11
    I' m using the ip_hash parameter too but i don't understand exactly what mean your pool values ? in php-pool conf files ?
     
  12. Revenge

    Revenge Active Member

    456
    93
    28
    Feb 21, 2016
    Portugal
    Ratings:
    +347
    Local Time:
    4:40 AM
    1.9.x
    10.1.x
    In each pool conf file, you set the max children's. The more pools you have, the more careful you need to be with the amount of children's you set in each of them or you can very easily overload your server.

    Over the time, in those 2 servers i concluded that the ideal values were 30 children's in one of them, and 100 Children's in the other. What i did was try to maintain that number of Children's while raising the number of pool's for the internal load balancing.
     
  13. negative

    negative Active Member

    406
    49
    28
    Apr 11, 2015
    Ratings:
    +96
    Local Time:
    6:40 AM
    1.9.10
    10.1.11
    I use that settings on every pool config now.

    Code:
    pm = dynamic
    pm.max_children = 256
    pm.start_servers = 24
    pm.min_spare_servers = 12
    pm.max_spare_servers = 36
    pm.max_requests = 1000
    And no problem, no overload.

    *Server has 24 core, 48gb ddr3 ram and only runs nginx web server ( no other service ) database server separated.
     
  14. rdan

    rdan Well-Known Member

    4,983
    1,185
    113
    May 25, 2014
    Ratings:
    +1,804
    Local Time:
    11:40 AM
    Mainline
    10.2
    That is WAY TOO MUCH :D.
    You will not suffer overload of server if you have small amount of visitors.
     
  15. negative

    negative Active Member

    406
    49
    28
    Apr 11, 2015
    Ratings:
    +96
    Local Time:
    6:40 AM
    1.9.10
    10.1.11
    Because it is dynamic, not static or on demand mode.

    But anyway, i will decrease the config half by half :)
     
  16. Revenge

    Revenge Active Member

    456
    93
    28
    Feb 21, 2016
    Portugal
    Ratings:
    +347
    Local Time:
    4:40 AM
    1.9.x
    10.1.x
    You have a server with lot of resources, so no problem ;)
    But run some benchmarks to stress the php-fpm children's, and check how the server handles it.
     
  17. Revenge

    Revenge Active Member

    456
    93
    28
    Feb 21, 2016
    Portugal
    Ratings:
    +347
    Local Time:
    4:40 AM
    1.9.x
    10.1.x
    I was getting the following error in nginx logs, more or less 2 to 3 times per hour. Some members of my forum also said sometimes they were seeing a 502 page error. It was this:

    Code:
     upstream sent unexpected FastCGI record: 3 
    I turned off fastcgi_keep_conn and the error stopped happening.

    Did someone noticed this? I think its related to this bug report: PHP :: Bug #67583 :: double fastcgi_end_request on max_children limit
     
  18. eva2000

    eva2000 Administrator Staff Member

    45,155
    10,272
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,919
    Local Time:
    1:40 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    what's the actual full error log line for that error ? which PHP version ? not having any issues here on PHP 5.6.19

    ah similar theory by Maxim at Re: Nginx patch for unexpected FASTCGI_END_REQUEST on php keep_conn + fastcgi_finish_request
     
    Last edited: Mar 22, 2016
  19. Revenge

    Revenge Active Member

    456
    93
    28
    Feb 21, 2016
    Portugal
    Ratings:
    +347
    Local Time:
    4:40 AM
    1.9.x
    10.1.x
    I have a doubt.
    We can designate some pools in the upstream as backup. Nginx Docs says that those backups will only be used if the other pools are unavailable.

    What unavailable means? Only if the pool is down, or also if the pool have reached the maximum children's?
     
  20. eva2000

    eva2000 Administrator Staff Member

    45,155
    10,272
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,919
    Local Time:
    1:40 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    unavailable = not able to respond to requests