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

Glory or Fail?

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by pamamolf, Jun 27, 2014.

  1. pamamolf

    pamamolf Premium Member Premium Member

    4,071
    427
    83
    May 31, 2014
    Ratings:
    +833
    Local Time:
    3:14 PM
    Nginx-1.25.x
    MariaDB 10.3.x
    Hi

    I told to a friend about Centminmod and he is ready to move to it :)


    I told him the best for you George and for Centminmod !

    He has about 10 sites at cpanel at the moment using Apache 2.2.23 and PHP 5.3.20 using PHP 5 Handler fcgi and Apache suEXEC on.

    Yesterday i help him with a semaphore limit .....

    On busy times he has about 14.000 connections on the main site and the rest 9 sites total they have about 1.000 connections only all together.

    Checked using:
    netstat -n | grep :80 |wc -l

    So he is ready to move to a new very HUGE dedicated server next week Centminmod :)

    In my opinion he is not need so big server but if he want it no problem for me :)

    CPU: Intel Xeon 2x E5-2650v2 16c/32t 2,6 GHz+/3,4 GHz+
    RAM: 128 GB DDR3 ECC 1600MHz
    Disks: 3 x 480 GB SSD Intel DC S3500 SATA3 6 GbpsHardRAID+ LSI 9271-4i FastPath - RAID 5
    free IPs* 256 IPs
    Public network card: 1x 1 Gbps



    So what do you think i must be take care for such case so i can have the success story and advertise you on his forum also with more than 500.000 users?

    I am thinking to increase some kernel limits like open files and a few more and to use for php-fpm the dynamic option plus APC and Memcache.

    Please advice :)

    Thanks !!!
     
  2. eva2000

    eva2000 Administrator Staff Member

    53,866
    12,160
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,712
    Local Time:
    11:14 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Thanks for the mention.. what's your friend's forum(s) url ?

    As I said, specific Centmin Mod server optimisation is left to the end user to figure out through monitoring (i.e. munin etc, phpstatus https://community.centminmod.com/threads/pm-max_children.479/ and nginx status (see below on how to enable it), and trial and error testing ;)

    For Nginx status page /nginx_status similar to /phpstatus https://community.centminmod.com/threads/pm-max_children.479/#post-2036 you need to read http://wiki.nginx.org/HttpStubStatusModule and add the following lines to your main hostname's vhost via command shortcut = vhostconf (/usr/local/nginx/conf/conf.d/virtual.conf )

    Code:
            location /nginx_status {
            stub_status on;
            access_log   off;
            allow 127.0.0.1;
            allow yourownipaddressifyouwantwebaccessiblepage;
            deny all;
            }
    i.e. main virtual.conf Nginx vhost where you'd access stats from yourhostname.com/nginx_status or via lynx or curl within SSH and use http://wiki.nginx.org/HttpStubStatusModule to understand what the stats mean.

    Code:
    lynx -dump localhost/nginx_status
    
    Active connections: 6
    server accepts handled requests
    5277 5277 12991
    Reading: 0 Writing: 1 Waiting: 5
    Code:
    server {
    #         listen   80;
                listen   80 default_server backlog=2048;
                server_name yourhostname.com;
                root   html;
    
            access_log              /var/log/nginx/localhost.access.log     main buffer=32k;
            error_log               /var/log/nginx/localhost.error.log      error;
    
    # ngx_pagespeed & ngx_pagespeed handler
    #include /usr/local/nginx/conf/pagespeed.conf;
    #include /usr/local/nginx/conf/pagespeedhandler.conf;
    #include /usr/local/nginx/conf/pagespeedstatslog.conf;
    
    # limit_conn limit_per_ip 16;
    # ssi  on;
    
            location /nginx_status {
            stub_status on;
            access_log   off;
            allow 127.0.0.1;
            allow yourownipaddressifyouwantwebaccessiblepage;
            deny all;
            }
    
    
    starter values to try though for nginx.conf would be
    Code:
    worker_processes 4;
    worker_connections  16384;
    play with both values and see i.e. in increments or decrements of 2 and 8192 respectively - bearing in mine for worker_connections you only have 16 cores and 32 cpu threads available from that server processor dual Xeon E5-2650v2 which has to be balanced with your php-fpm children

    for php-fpm.com (/usr/local/etc/php-fpm.conf) accessed via command shortcut = fpmconf and monitor your php-fpm error log for messages at /var/log/php-fpm/www-php.error.log (path defined in php-fpm.conf)

    play with these settings using info at https://community.centminmod.com/threads/pm-max_children.479/#post-2036 and http://www.php.net/manual/en/install.fpm.configuration.php as a guide

    Code:
    pm = ondemand or static for starters and try dynamic once you understand it's required tuned values mentioned at http://www.php.net/manual/en/install.fpm.configuration.php
    pm.max_children = 10 bump and try 32
    ; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
    pm.start_servers = 20
    pm.min_spare_servers = 5
    pm.max_spare_servers = 35
    pm.max_requests = 5000 bump and try 10000
    
    pm.process_idle_timeout = 10s;
    
    Optimising APC Cache or Zend OpCache is the same monitoring and trial and error testing. APC Cache already outlined about monitoring at https://community.centminmod.com/th...le-to-allocate-memory-for-pool.541/#post-2385. It's same process for Zend OpCache but with opcache.php file instead of myapc.php file. The opcache.php file is located in .07 beta and higher versions at /usr/local/src/centmin-v1.2.3mod/config/zendopcache/opcache.php and needs moving to /usr/local/nginx/html with same APC Cache myapc.php treatment for randomised prefix and password protection as outlined at https://community.centminmod.com/th...le-to-allocate-memory-for-pool.541/#post-2385. Using the admin stats pages for APC Cache or Zend Opcache, you can allocate memory to their caches as needed.
     
  3. pamamolf

    pamamolf Premium Member Premium Member

    4,071
    427
    83
    May 31, 2014
    Ratings:
    +833
    Local Time:
    3:14 PM
    Nginx-1.25.x
    MariaDB 10.3.x
    Is HttpStubStatusModule ready to use after Centminmod installation?

    Remind me please the file (path) that i must edit to add this so i will enable it:

    Code:
            location /nginx_status {
            stub_status on;
            access_log   off;
            allow 127.0.0.1;
            allow yourownipaddressifyouwantwebaccessiblepage;
            deny all;
            }
    
    Is this ok for such case:

    Code:
    worker_priority -10;
    What can i cache in this scenario on Memcache?
     
  4. eva2000

    eva2000 Administrator Staff Member

    53,866
    12,160
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,712
    Local Time:
    11:14 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    2nd post in this thread outlines the main hostname vhost virtual.conf to add it

    yup already compiled into Centmin Mod Nginx

    as to what you can cache with Memcached, all depends on your web app i.e. Wordpress, vBulletin, Xenforo etc all have settings and/or addon/plugins which can use Memcached server caching i.e. vBulletin would be DataStore caching https://www.vbulletin.com/docs/html/datastore and Xenforo backend caching http://xenforo.com/help/cache/
     
  5. pamamolf

    pamamolf Premium Member Premium Member

    4,071
    427
    83
    May 31, 2014
    Ratings:
    +833
    Local Time:
    3:14 PM
    Nginx-1.25.x
    MariaDB 10.3.x
    OK thanks and what about this?

    Code:
    worker_priority -10;
    Do i have to change it to something like -2 ?
     
  6. eva2000

    eva2000 Administrator Staff Member

    53,866
    12,160
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,712
    Local Time:
    11:14 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    just leave it
     
  7. pamamolf

    pamamolf Premium Member Premium Member

    4,071
    427
    83
    May 31, 2014
    Ratings:
    +833
    Local Time:
    3:14 PM
    Nginx-1.25.x
    MariaDB 10.3.x
    Also i am thinking to use Innodb tables :)
     
  8. pamamolf

    pamamolf Premium Member Premium Member

    4,071
    427
    83
    May 31, 2014
    Ratings:
    +833
    Local Time:
    3:14 PM
    Nginx-1.25.x
    MariaDB 10.3.x
    If i use static:

    Code:
    pm = static
    pm.max_children =
    pm.max_requests = 
    
    Do i have to comment the rest settings or they will be ignored anyway?

    Code:
    pm.start_servers
    pm.min_spare_servers
    pm.max_spare_servers
    
     
  9. eva2000

    eva2000 Administrator Staff Member

    53,866
    12,160
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,712
    Local Time:
    11:14 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    the rest get ignored so no need to comment them out :)
     
  10. pamamolf

    pamamolf Premium Member Premium Member

    4,071
    427
    83
    May 31, 2014
    Ratings:
    +833
    Local Time:
    3:14 PM
    Nginx-1.25.x
    MariaDB 10.3.x
    Hi

    The pm.max_requests = is per children or total?

    Example:

    Code:
    pm.max_children =10
    pm.max_requests =5000
    
    Does that means that it can handle 50.000 connections or 5.000 connections total?

    Thanks
     
  11. eva2000

    eva2000 Administrator Staff Member

    53,866
    12,160
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,712
    Local Time:
    11:14 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Answer neatly posted at https://community.centminmod.com/threads/pm-max_children.479/#post-2036

    so 50k total