Learn about Centmin Mod LEMP Stack today
Register Now

Wordpress What I'm missing with Nginx Level Redis + Redis Object Cache (inc Benchmark)

Discussion in 'Blogs & CMS usage' started by AKIN SENOL, Mar 24, 2016.

  1. AKIN SENOL

    AKIN SENOL Member

    36
    3
    8
    Oct 17, 2014
    London
    Ratings:
    +8
    Local Time:
    9:47 PM
    1.9.12
    10.1.12
    A long time after I'm excited to read PHP 7.0.1 + Redis Cache for Wordpress and then I deployed with 123.09beta01 and WP /subdir (Redis Object Cache + Nginx Helper plugins) on Linode's Germany 2gb VPS.

    But my results different and included timeout;

    [​IMG]
    [​IMG]
    [​IMG]
    nginx.conf
    Code:
    user              nginx nginx;
    worker_processes auto;
    worker_priority -10;
    
    worker_rlimit_nofile 260000;
    timer_resolution 100ms;
    
    pcre_jit on;
    include /usr/local/nginx/conf/dynamic-modules.conf;
    
    
    pid         logs/nginx.pid;
    
    events {
        worker_connections  4096;
        #worker_connections  12288;
        accept_mutex on;
        accept_mutex_delay 200ms;
        use epoll;
        #multi_accept on;
    }
    
    http {
    #include /usr/local/nginx/conf/passenger.conf;
    include /usr/local/nginx/conf/redisupstream.conf;
    limit_req_zone $binary_remote_addr zone=xwprpc:10m rate=30r/s;
    
    map_hash_bucket_size 128;
    map_hash_max_size 4096;
    server_names_hash_bucket_size 128;
    server_names_hash_max_size 2048;
    
    limit_req_zone $binary_remote_addr zone=xwplogin:16m rate=40r/m;
    #limit_conn_zone $binary_remote_addr zone=xwpconlimit:16m;
    
    #more_set_headers "Server: nginx centminmod";
    more_set_headers "X-Powered-By: centminmod";
    
    # uncomment cloudflare.conf include if using cloudflare for
    # server and/or vhost site
    include /usr/local/nginx/conf/cloudflare.conf;
    include /usr/local/nginx/conf/maintenance.conf;
    include /usr/local/nginx/conf/vts_http.conf;
    include /usr/local/nginx/conf/geoip.conf;
    #include /usr/local/nginx/conf/pagespeedadmin.conf;
    include /usr/local/nginx/conf/fastcgi_param_https_map.conf;
    include /usr/local/nginx/conf/brotli_inc.conf;
    log_format      main    '$remote_addr - $remote_user [$time_local] $request '
                    '"$status" $body_bytes_sent "$http_referer" '
                    '"$http_user_agent" "$http_x_forwarded_for" "$gzip_ratio"'
                    ' "$connection" "$connection_requests" "$request_time"';
    
    access_log  logs/access.log combined buffer=128k flush=5m;
    error_log   logs/error.log warn;
    
        index  index.php index.html index.htm;
        include       mime.types;
        default_type  application/octet-stream;
        charset utf-8;
    
            sendfile on;
            sendfile_max_chunk 512k;
            tcp_nopush  on;
            tcp_nodelay on;
            server_tokens off;
            server_name_in_redirect off;
          
            keepalive_timeout  8;
            keepalive_requests 1000;
            lingering_time 20s;
            lingering_timeout 5s;
            keepalive_disable msie6;
    
        gzip on;
        gzip_vary   on;
        gzip_disable "MSIE [1-6]\.";
            gzip_static on;
            gzip_min_length   1400;
            gzip_buffers      32 8k;
            gzip_http_version 1.0;
            gzip_comp_level 5;
            gzip_proxied    any;
            gzip_types text/plain text/css text/xml application/javascript application/x-javascript application/xml application/xml+rss application/ecmascript application/json image/svg+xml;
    
    client_body_buffer_size 256k;
    client_body_in_file_only off;
    client_body_timeout 10s;
    client_header_buffer_size 64k;
    ## how long a connection has to complete sending
    ## it's headers for request to be processed
    client_header_timeout  8s;
    client_max_body_size 50m;
    connection_pool_size  512;
    directio  4m;
    ignore_invalid_headers on;     
    large_client_header_buffers 8 64k;
    output_buffers   8 256k;
    postpone_output  1460;
    proxy_temp_path  /tmp/nginx_proxy/;
    request_pool_size  32k;
    reset_timedout_connection on;
    send_timeout     15s;
    types_hash_max_size 2048;
    
    # for nginx proxy backends to prevent redirects to backend port
    # port_in_redirect off;
    
    open_file_cache max=50000 inactive=60s;
    open_file_cache_valid 120s;
    open_file_cache_min_uses 2;
    open_file_cache_errors off;
    open_log_file_cache max=10000 inactive=30s min_uses=2;
    
    ## limit number of concurrency connections per ip to 16
    ## add to your server {} section the next line
    ## limit_conn limit_per_ip 16;
    ## uncomment below line allows 500K sessions
    # limit_conn_log_level error;
    #######################################
    # use limit_zone for Nginx <v1.1.7 and lower
    # limit_zone $binary_remote_addr zone=limit_per_ip:16m;
    #######################################
    # use limit_conn_zone for Nginx >v1.1.8 and higher
    # limit_conn_zone $binary_remote_addr zone=limit_per_ip:16m;
    #######################################
    
    include /usr/local/nginx/conf/conf.d/*.conf;
    }
    
    example.com.conf
    Code:
    # Centmin Mod Getting Started Guide
    # must read http://centminmod.com/getstarted.html
    # For SPDY SSL Setup
    # read http://centminmod.com/nginx_configure_https_ssl_spdy.html
    
    # redirect from www to non-www  forced SSL
    # uncomment, save file and restart Nginx to enable
    # if unsure use return 302 before using return 301
    # server {
    #   server_name example.com www.example.com;
    #    return 302 https://$server_name$request_uri;
    # }
    map $http_host $blogid {
        default       -999;
        include /home/nginx/domains/example.com/public/wp-content/uploads/nginx-helper/map.conf;  
        }
    
    server {
      listen 443 ssl http2;
      listen [::]:443 ssl http2;
      server_name example.com www.example.com;
    
      ssl_dhparam /usr/local/nginx/conf/ssl/example.com/dhparam.pem;
      ssl_certificate      /usr/local/nginx/conf/ssl/example.com/example.com.crt;
      ssl_certificate_key  /usr/local/nginx/conf/ssl/example.com/example.com.key;
      include /usr/local/nginx/conf/ssl_include.conf;
    
      # mozilla recommended
      ssl_ciphers EECDH+CHACHA20-draft:EECDH+CHACHA20:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA:!CAMELLIA:!DES-CBC3-SHA;
      ssl_prefer_server_ciphers   on;
      add_header Alternate-Protocol  443:npn-spdy/3;
      # HTTP Public Key Pinning Header uncomment only one that applies include or exclude domains.
      # You'd want to include subdomains if you're using SSL wildcard certificates
      # include subdomain
      add_header Public-Key-Pins 'pin-sha256="khCnBS93Z8GCqLoKXimMM0pjxCnwlaxyw2zp/szHL5Y="; pin-sha256="ONZwMFhVhWUVZ/qyZ/CKATOQ4mfPl95Ad06+BkTL+20="; max-age=15552000; includeSubDomains';
      # exclude subdomains
      #add_header Public-Key-Pins 'pin-sha256="khCnBS93Z8GCqLoKXimMM0pjxCnwlaxyw2zp/szHL5Y="; pin-sha256="ONZwMFhVhWUVZ/qyZ/CKATOQ4mfPl95Ad06+BkTL+20="; max-age=86400';
      add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";
      add_header X-Frame-Options SAMEORIGIN;
      add_header X-Xss-Protection "1; mode=block" always;
      add_header X-Content-Type-Options "nosniff" always;
      #spdy_headers_comp 5;
      ssl_buffer_size 1400;
      ssl_session_tickets on;
    
      # enable ocsp stapling
      #resolver 8.8.8.8 8.8.4.4 valid=10m;
      #resolver_timeout 10s;
      #ssl_stapling on;
      #ssl_stapling_verify on;
      #ssl_trusted_certificate /usr/local/nginx/conf/ssl/example.com/example.com-trusted.crt;
    
    # 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;
    
      #add_header X-Frame-Options SAMEORIGIN;
      #add_header X-Xss-Protection "1; mode=block" always;
      #add_header X-Content-Type-Options "nosniff" always;
    
      # limit_conn limit_per_ip 16;
      # ssi  on;
    
      access_log /home/nginx/domains/example.com/log/access.log combined buffer=256k flush=60m;
      error_log /home/nginx/domains/example.com/log/error.log;
    
      root /home/nginx/domains/example.com/public;
    
      aio threads;
    
      # uncomment cloudflare.conf include if using cloudflare for
      # server and/or vhost site
      include /usr/local/nginx/conf/cloudflare.conf;
      include /usr/local/nginx/conf/503include-main.conf;
    
      # prevent access to ./directories and files
      location ~ (?:^|/)\. {
       deny all;
      }
    
       include /usr/local/nginx/conf/multisite-admin-rw.conf;
    
      #include /usr/local/nginx/conf/wpincludes/example.com/wpcacheenabler_example.com.conf;
      #include /usr/local/nginx/conf/wpincludes/example.com/wpsupercache_example.com.conf;
      # https://community.centminmod.com/posts/18828/
      include /usr/local/nginx/conf/wpincludes/example.com/rediscache_example.com.conf;
    
      location / {
      include /usr/local/nginx/conf/503include-only.conf;
    
      #if ($http_accept ~ "image/webp"){
    #rewrite (.+)\.(jpe?g|png)$ /$request_filename.webp;
    #}
    
      # Enables directory listings when index file not found
      #autoindex  on;
    
      # for wordpress super cache plugin
      ###try_files /wp-content/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /index.php?q=$uri&$args;
    
      # for wp cache enabler plugin
      #try_files $cache_enabler_uri $uri $uri/ $custom_subdir/index.php?$args;
    
      # Wordpress Permalinks
      #try_files $uri $uri/ /index.php?q=$uri&$args;
    
      # Nginx level redis Wordpress
      # https://community.centminmod.com/posts/18828/
      try_files $uri $uri/ /index.php?$args;
      include /usr/local/nginx/conf/multisite-permalinks.conf;
      }
    
    location ~* /(wp-login\.php) {
        limit_req zone=xwplogin burst=5 nodelay;
        #limit_conn xwpconlimit 30;
        #auth_basic "Private";
        #auth_basic_user_file /home/nginx/domains/example.com/htpasswd_wplogin;  
        #include /usr/local/nginx/conf/php-wpsc.conf;
        # https://community.centminmod.com/posts/18828/
        include /usr/local/nginx/conf/php-rediscache.conf;
    }
    
    location ~* /(xmlrpc\.php) {
        limit_req zone=xwprpc burst=45 nodelay;
        #limit_conn xwpconlimit 30;
        #include /usr/local/nginx/conf/php-wpsc.conf;
        # https://community.centminmod.com/posts/18828/
        include /usr/local/nginx/conf/php-rediscache.conf;
    }
    
      include /usr/local/nginx/conf/wpincludes/example.com/wpsecure_example.com.conf;
      #include /usr/local/nginx/conf/php-wpsc.conf;
      # https://community.centminmod.com/posts/18828/
      include /usr/local/nginx/conf/php-rediscache.conf;
      include /usr/local/nginx/conf/staticfiles.conf;
      include /usr/local/nginx/conf/drop.conf;
      #include /usr/local/nginx/conf/errorpage.conf;
      include /usr/local/nginx/conf/vts_server.conf;
    }
    
    php-rediscache.conf
    Code:
    location ~ \.php$ {
        set $key "nginx-cache:$scheme$request_method$host$request_uri";
        srcache_fetch_skip $skip_cache;
        srcache_store_skip $skip_cache;
        srcache_response_cache_control off;
        set_escape_uri $escaped_key $key;
        srcache_fetch GET /redis-fetch $key;
        srcache_store PUT /redis-store key=$escaped_key;
        more_set_headers 'X-Cache $srcache_fetch_status';
        more_set_headers 'X-Cache-2 $srcache_store_status';
    
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass   127.0.0.1:9000;
        #fastcgi_pass   unix:/tmp/php5-fpm.sock;
        fastcgi_index  index.php;
        #fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_param  SCRIPT_FILENAME    $request_filename;
        #fastcgi_param PHP_ADMIN_VALUE open_basedir=$document_root/:/usr/local/lib/php/:/tmp/;
    
    # might shave 200+ ms off PHP requests
    # which don't pass on a content length header
    # slightly faster page response time at the
    # expense of throughput / scalability
    #sendfile on;
    #tcp_nopush off;
    #keepalive_requests 0;
    
    fastcgi_connect_timeout 60;
    fastcgi_send_timeout 180;
    fastcgi_read_timeout 180;
    fastcgi_buffer_size 512k;
    fastcgi_buffers 512 16k;
    fastcgi_busy_buffers_size 1m;
    fastcgi_temp_file_write_size 4m;
    fastcgi_max_temp_file_size 4m;
    fastcgi_intercept_errors on;
    
    # next 3 lines when uncommented / enabled
    # allow Nginx to handle uploads which then
    # passes back the completed upload to PHP
    fastcgi_pass_request_body off;
    client_body_in_file_only clean;
    fastcgi_param  REQUEST_BODY_FILE  $request_body_file;
    
    #new .04+ map method
    fastcgi_param HTTPS $server_https;
    
    # comment out PATH_TRANSLATED line if /usr/local/lib/php.ini sets following:
    # cgi.fix_pathinfo=0
    # as of centminmod v1.2.3-eva2000.01 default is set to cgi.fix_pathinfo=1
    
    fastcgi_param  PATH_INFO          $fastcgi_path_info;
    #fastcgi_param  PATH_TRANSLATED    $document_root$fastcgi_path_info;
    
    fastcgi_param  QUERY_STRING       $query_string;
    fastcgi_param  REQUEST_METHOD     $request_method;
    fastcgi_param  CONTENT_TYPE       $content_type;
    fastcgi_param  CONTENT_LENGTH     $content_length;
    
    fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
    fastcgi_param  REQUEST_URI        $request_uri;
    fastcgi_param  DOCUMENT_URI       $document_uri;
    fastcgi_param  DOCUMENT_ROOT      $document_root;
    fastcgi_param  SERVER_PROTOCOL    $server_protocol;
    fastcgi_param  REQUEST_SCHEME     $scheme;
    fastcgi_param  HTTPS              $https if_not_empty;
    
    fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
    fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;
    
    fastcgi_param  REMOTE_ADDR        $remote_addr;
    fastcgi_param  REMOTE_PORT        $remote_port;
    fastcgi_param  SERVER_ADDR        $server_addr;
    fastcgi_param  SERVER_PORT        $server_port;
    fastcgi_param  SERVER_NAME        $server_name;
    
    # Set php-fpm geoip variables
    fastcgi_param GEOIP_COUNTRY_CODE $geoip_country_code;
    fastcgi_param GEOIP_COUNTRY_CODE3 $geoip_country_code3;
    fastcgi_param GEOIP_COUNTRY_NAME $geoip_country_name;
    fastcgi_param GEOIP_CITY_COUNTRY_CODE $geoip_city_country_code;
    fastcgi_param GEOIP_CITY_COUNTRY_CODE3 $geoip_city_country_code3;
    fastcgi_param GEOIP_CITY_COUNTRY_NAME $geoip_city_country_name;
    fastcgi_param GEOIP_REGION $geoip_region;
    fastcgi_param GEOIP_CITY $geoip_city;
    fastcgi_param GEOIP_POSTAL_CODE $geoip_postal_code;
    fastcgi_param GEOIP_CITY_CONTINENT_CODE $geoip_city_continent_code;
    fastcgi_param GEOIP_LATITUDE $geoip_latitude;
    fastcgi_param GEOIP_LONGITUDE $geoip_longitude;
    
    # PHP only, required if PHP was built with --enable-force-cgi-redirect
    fastcgi_param  REDIRECT_STATUS    200;
    
                       }
    
    wpincludes/example.com/rediscache_example.com.conf
    Code:
    set $skip_cache 0;
    
    # POST requests and urls with a query string should always go to PHP
    if ($request_method = POST) {
      set $skip_cache 1;
    }
    
    if ($query_string != "") {
      set $skip_cache 1;
    }
    
    # Don't cache uris containing the following segments
    if ($request_uri ~* "/wp-admin/|/xmlrpc.php|wp-.*.php|/feed/|index.php|sitemap(_index)?.xml") {
      set $skip_cache 1;
    }
    
    # Don't use the cache for logged in users or recent commenters
    if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") {
      set $skip_cache 1;
    }
    
    location /redis-fetch {
      internal  ;
      set  $redis_key $args;
      redis_pass  redisbackend;
      redis_connect_timeout 60000;
      redis_read_timeout 60000;
      redis_send_timeout 60000;
    }
    
    location /redis-store {
      internal  ;
      set_unescape_uri $key $arg_key ;
      redis2_query set $key $echo_request_body;
      redis2_query expire $key 6h;
      redis2_pass  redisbackend;
      redis2_connect_timeout 60s;
      redis2_read_timeout 60s;
      redis2_send_timeout 60s;
    }
    
    redisupstream.conf

    Code:
    upstream redisbackend {
      zone upstream_redis 64k;
      server 127.0.0.1:6379 weight=1 max_fails=3 fail_timeout=30s;
      #server 127.0.0.1:6380 weight=1 max_fails=3 fail_timeout=30s;
      #server 127.0.0.1:6381 weight=1 max_fails=3 fail_timeout=30s;
      #server 127.0.0.1:6382 weight=1 max_fails=3 fail_timeout=30s;
      #server 127.0.0.1:6383 weight=1 max_fails=3 fail_timeout=30s;
      #server 127.0.0.1:6384 weight=1 max_fails=3 fail_timeout=30s;
    
      #server 127.0.0.1:6380 backup;
      keepalive 4096;
    }
    
    But also in this time I achieved very low load time (VPS on Germany)

    [​IMG]

    What I'm missing @eva2000 (n)
     
    Last edited: Mar 24, 2016
  2. AKIN SENOL

    AKIN SENOL Member

    36
    3
    8
    Oct 17, 2014
    London
    Ratings:
    +8
    Local Time:
    9:47 PM
    1.9.12
    10.1.12
    And here is the redmon stats which is same time with loader.io test

    [​IMG]

    [​IMG]
     
  3. eva2000

    eva2000 Administrator Staff Member

    30,902
    6,908
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,404
    Local Time:
    7:47 AM
    Nginx 1.13.x
    MariaDB 5.5
    response time is also a function of geographic/physical distance between test location and target server/vps (i.e. ping times). So further apart the test location loader.io and target server/vps = higher response times and pings

    also could be Linode outbound bandwidth speed cap as 2GB Linode has 250Mbps out cap see Cloud Server Plans and Pricing - Linode

    1.27GB received over ~35seconds = 37.157MB/s speed or 297.25Mbp/s

    or if it's 60 seconds = (1.27x1024)/60 = 21.675MB/s or 173.4Mbp/s

    my wordpress7 loader.io pushed out 6.38GB for 60 seconds = ~871Mbp/s for 2GB DO VPS with 1Gbps in/out
     
    Last edited: Mar 24, 2016
  4. AKIN SENOL

    AKIN SENOL Member

    36
    3
    8
    Oct 17, 2014
    London
    Ratings:
    +8
    Local Time:
    9:47 PM
    1.9.12
    10.1.12
    Now it makes sense,

    I made some additional tests and when test received to ~295MB, timeout errors coming

    Thank you for information and formula @eva2000
     
    Last edited: Mar 24, 2016
    • Like Like x 1
  5. eva2000

    eva2000 Administrator Staff Member

    30,902
    6,908
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,404
    Local Time:
    7:47 AM
    Nginx 1.13.x
    MariaDB 5.5
    Yeah be wary of network in/out caps if not the usual 1Gbps speeds for network in/out :)
     
  6. AKIN SENOL

    AKIN SENOL Member

    36
    3
    8
    Oct 17, 2014
    London
    Ratings:
    +8
    Local Time:
    9:47 PM
    1.9.12
    10.1.12
    I have a another new deploy on Vultr 2GB (Germany) which is gave me faster Centmin Mod install time (1123.089551486 sec) than Linode (1769.890844052 sec)

    Anyway, when I run loader.io maintain 0-10000/min test after Wordpress Install (with Supercache, via 22th menu) gave me amazing result;

    [​IMG]

    After that I installed redis server with your document which is Redis - How to install Redis server on Centmin Mod LEMP stack | Centmin Mod Community And redis needed disable to transparent huge pages and enable overcommit_memory. When run hptweaks.sh, output
    but redis says;
    Code:
    750:M 25 Mar 16:49:51.105 # Server started, Redis version 3.0.7
    750:M 25 Mar 16:49:51.105 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
    750:M 25 Mar 16:49:51.105 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
    750:M 25 Mar 16:49:51.108 * DB loaded from disk: 0.004 seconds
    750:M 25 Mar 16:49:51.109 * The server is now ready to accept connections on port 6379
    750:M 25 Mar 16:52:29.099 # User requested shutdown...
    750:M 25 Mar 16:52:29.099 * Saving the final RDB snapshot before exiting.
    750:M 25 Mar 16:52:29.102 * DB saved on disk
    750:M 25 Mar 16:52:29.102 # Redis is now ready to exit, bye bye...
    
    So bash the echo never > /sys/kernel/mm/transparent_hugepage/enabled and sysctl vm.overcommit_memory=1.

    After tested with /root/tools/redisinfo.sh gave me result as a "Worst run took 767x longer than the average latency." ;
    Code:
    [root@de tools]# /root/tools/redisinfo.sh
    --------------------------------------------------------------------------
    redis-cli 3.0.7
    --------------------------------------------------------------------------
    redis-cli info
    # Server
    redis_version:3.0.7
    redis_git_sha1:00000000
    redis_git_dirty:0
    redis_build_id:33b0defdcca850ac
    redis_mode:standalone
    os:Linux 3.10.0-327.10.1.el7.x86_64 x86_64
    arch_bits:64
    multiplexing_api:epoll
    gcc_version:4.8.5
    process_id:2496
    run_id:684aa14fe705765f718aa6cee4497d10ba14c364
    tcp_port:6379
    uptime_in_seconds:1141
    uptime_in_days:0
    hz:10
    lru_clock:16085314
    config_file:/etc/redis.conf
    
    # Clients
    connected_clients:1
    client_longest_output_list:0
    client_biggest_input_buf:0
    blocked_clients:0
    
    # Memory
    used_memory:855152
    used_memory_human:835.11K
    used_memory_rss:2621440
    used_memory_peak:911848
    used_memory_peak_human:890.48K
    used_memory_lua:36864
    mem_fragmentation_ratio:3.07
    mem_allocator:jemalloc-3.6.0
    
    # Persistence
    loading:0
    rdb_changes_since_last_save:8
    rdb_bgsave_in_progress:0
    rdb_last_save_time:1458925650
    rdb_last_bgsave_status:ok
    rdb_last_bgsave_time_sec:0
    rdb_current_bgsave_time_sec:-1
    aof_enabled:0
    aof_rewrite_in_progress:0
    aof_rewrite_scheduled:0
    aof_last_rewrite_time_sec:-1
    aof_current_rewrite_time_sec:-1
    aof_last_bgrewrite_status:ok
    aof_last_write_status:ok
    
    # Stats
    total_connections_received:34
    total_commands_processed:232
    instantaneous_ops_per_sec:0
    total_net_input_bytes:54639
    total_net_output_bytes:805934
    instantaneous_input_kbps:0.00
    instantaneous_output_kbps:0.00
    rejected_connections:0
    sync_full:0
    sync_partial_ok:0
    sync_partial_err:0
    expired_keys:8
    evicted_keys:0
    keyspace_hits:60
    keyspace_misses:47
    pubsub_channels:0
    pubsub_patterns:0
    latest_fork_usec:219
    migrate_cached_sockets:0
    
    # Replication
    role:master
    connected_slaves:0
    master_repl_offset:0
    repl_backlog_active:0
    repl_backlog_size:1048576
    repl_backlog_first_byte_offset:0
    repl_backlog_histlen:0
    
    # CPU
    used_cpu_sys:0.67
    used_cpu_user:0.40
    used_cpu_sys_children:0.00
    used_cpu_user_children:0.00
    
    # Cluster
    cluster_enabled:0
    
    # Keyspace
    db7:keys=8,expires=8,avg_ttl=290628
    
    --------------------------------------------------------------------------
    redis-cli --intrinsic-latency 10
    Max latency so far: 4 microseconds.
    Max latency so far: 15 microseconds.
    Max latency so far: 16 microseconds.
    Max latency so far: 22 microseconds.
    Max latency so far: 24 microseconds.
    Max latency so far: 30 microseconds.
    Max latency so far: 68 microseconds.
    Max latency so far: 86 microseconds.
    Max latency so far: 124 microseconds.
    Max latency so far: 166 microseconds.
    Max latency so far: 3391 microseconds.
    
    2260779 total runs (avg latency: 4.4233 microseconds / 44232.54 nanoseconds per run).
    Worst run took 767x longer than the average latency.
    
    --------------------------------------------------------------------------
    vmstat 1 10
    procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
    r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
    1  0      0 1321176  19280 238492    0    0    80     3   86  111  3  0 97  0  0
    0  0      0 1321224  19280 238492    0    0     0     0   97  199  0  0 100  0  0
    0  0      0 1321224  19280 238492    0    0     0     0   99  193  0  0 100  0  0
    0  0      0 1321224  19280 238492    0    0     0     0   89  179  0  0 100  0  0
    0  0      0 1321224  19280 238492    0    0     0     0   90  184  0  0 100  0  0
    0  0      0 1321224  19280 238492    0    0     0     0   88  172  0  0 99  0  0
    0  0      0 1321224  19280 238492    0    0     0     0  100  194  0  0 100  0  0
    0  0      0 1321224  19280 238492    0    0     0     0  102  199  0  0 100  0  0
    0  0      0 1321224  19288 238484    0    0     0    12  114  214  0  0 100  0  0
    0  0      0 1321224  19288 238492    0    0     0     0   96  182  0  0 100  0  0
    --------------------------------------------------------------------------
    
    smem -kU redis
      PID User     Command                         Swap      USS      PSS      RSS
    2496 redis    /usr/bin/redis-server 127.0        0     1.5M     1.6M     2.5M
    --------------------------------------------------------------------------
    
    --------------------------------------------------------------------------
    smem -kmU redis
    Map                                       PIDs   AVGPSS      PSS
    [vdso]                                       1        0        0
    [vsyscall]                                   1        0        0
    /usr/lib/locale/locale-archive               1     6.0K     6.0K
    /usr/lib64/libdl-2.17.so                     1     8.0K     8.0K
    [stack:2497]                                 1     8.0K     8.0K
    [stack:2498]                                 1     8.0K     8.0K
    /usr/lib64/ld-2.17.so                        1    11.0K    11.0K
    /usr/lib64/libpthread-2.17.so                1    11.0K    11.0K
    /usr/lib64/libm-2.17.so                      1    14.0K    14.0K
    [stack]                                      1    20.0K    20.0K
    /usr/lib64/libjemalloc.so.1                  1    41.0K    41.0K
    /usr/lib64/libc-2.17.so                      1    52.0K    52.0K
    /usr/bin/redis-server                        1   488.0K   488.0K
    <anonymous>                                  1   964.0K   964.0K
    --------------------------------------------------------------------------
    
    --------------------------------------------------------------------------
    smem -tpk
      PID User     Command                         Swap      USS      PSS      RSS
      437 root     /sbin/rngd -f                      0   172.0K   187.0K   672.0K
      775 root     /sbin/agetty --noclear tty1        0   160.0K   188.0K   856.0K
      849 nsd      /usr/local/sbin/nsd -c /etc        0    76.0K   221.0K  1016.0K
      856 nsd      /usr/local/sbin/nsd -c /etc        0   152.0K   268.0K   612.0K
      434 root     /usr/sbin/irqbalance --fore        0   296.0K   374.0K     1.2M
      855 nsd      /usr/local/sbin/nsd -c /etc        0   308.0K   426.0K   856.0K
    2979 root     /bin/bash /root/tools/redis        0   220.0K   442.0K     1.5M
      469 root     /usr/sbin/crond -n                 0   680.0K   717.0K     1.6M
      424 root     /usr/lib/systemd/systemd-lo        0   772.0K   810.0K     1.7M
      390 dbus     /bin/dbus-daemon --system -        0   812.0K   859.0K     1.7M
      354 root     /usr/lib/systemd/systemd-ud        0   804.0K   883.0K     1.8M
      444 ntp      /usr/sbin/ntpd -u ntp:ntp -        0  1012.0K     1.1M     2.3M
      751 root     /usr/sbin/sshd -D                  0   848.0K     1.1M     3.5M
    1417 root     /usr/libexec/postfix/master        0     1.2M     1.2M     2.2M
      341 root     /usr/lib/systemd/systemd-jo        0   952.0K     1.3M     2.6M
      778 root     pure-ftpd (SERVER)                 0     1.3M     1.5M     2.7M
    1420 postfix  pickup -l -t unix -u               0     1.2M     1.5M     4.0M
    2960 postfix  bounce -z -n defer -t unix         0     1.3M     1.5M     4.1M
    2496 redis    /usr/bin/redis-server 127.0        0     1.5M     1.6M     2.5M
    1421 postfix  qmgr -l -t unix -u                 0     1.4M     1.6M     4.2M
    1445 postfix  tlsmgr -l -t unix -u               0     1.7M     1.9M     4.6M
    2168 root     sshd: root@notty                   0     1.3M     2.0M     4.9M
      431 root     /usr/sbin/rsyslogd -n              0     1.8M     2.2M     3.6M
    2295 root     sshd: root@pts/0                   0     1.6M     2.3M     5.3M
    2170 root     -bash                              0     2.3M     2.6M     3.7M
        1 root     /usr/lib/systemd/systemd --        0     2.6M     2.7M     3.7M
    2959 postfix  smtp -t unix -u                    0     2.6M     3.0M     5.9M
    2298 root     -bash                              0     3.6M     3.8M     5.0M
      429 root     /usr/sbin/haveged -w 1024 -        0     5.8M     5.8M     6.4M
    2476 polkitd  /usr/lib/polkit-1/polkitd -        0     5.6M     6.0M     7.9M
    3004 root     python /usr/bin/smem -tpk          0     5.6M     6.2M     7.7M
      923 root     php-fpm: master process (/u        0     8.4M     8.4M     8.9M
      691 root     /sbin/dhclient -H de -1 -q         0    12.3M    12.3M    12.5M
      753 root     /usr/bin/python -Es /usr/sb        0    11.9M    13.0M    16.1M
    1496 root     lfd - sleepin                      0    22.2M    22.2M    22.9M
    1319 root     nginx: master process /usr/        0    10.3M    27.8M    63.1M
    1327 nginx    nginx: worker process              0    14.5M    32.3M    68.2M
    1328 nginx    nginx: worker process              0    14.5M    32.3M    68.2M
      746 mysql    /usr/sbin/mysqld                   0    95.8M    96.1M    98.2M
    -------------------------------------------------------------------------------
       39 9                                           0   239.2M   300.7M   458.2M
    --------------------------------------------------------------------------
    
    --------------------------------------------------------------------------
    free -mlt
                  total        used        free      shared  buff/cache   available
    Mem:           1839         297        1290          36         251        1325
    Low:           1839         549        1290
    High:             0           0           0
    Swap:             0           0           0
    Total:         1839         297        1290
    --------------------------------------------------------------------------
    After test with siege and curl for nginx helper check;

    First siege
    Code:
    [root@de tools]# siege -b -c50 -r100 http://example.com
    
    Transactions:                   5000 hits
    Availability:                 100.00 %
    Elapsed time:                   2.37 secs
    Data transferred:              14.51 MB
    Response time:                  0.02 secs
    Transaction rate:            2109.70 trans/sec
    Throughput:                     6.12 MB/sec
    Concurrency:                   34.88
    Successful transactions:        5000
    Failed transactions:               0
    Longest transaction:            1.97
    Shortest transaction:           0.00
    
    Second Siege
    Code:
    Transactions:                   5000 hits
    Availability:                 100.00 %
    Elapsed time:                   1.59 secs
    Data transferred:              14.51 MB
    Response time:                  0.02 secs
    Transaction rate:            3144.65 trans/sec
    Throughput:                     9.13 MB/sec
    Concurrency:                   47.72
    Successful transactions:        5000
    Failed transactions:               0
    Longest transaction:            0.05
    Shortest transaction:           0.00
    
    And curl
    Code:
    curl -s http://example.com | tail -3
    
    <!--Cached using Nginx-Helper on 2016-03-25 17:17:06. It took 2 queries executed in 0.136 seconds.-->
    <!--Visit http://wordpress.org/extend/plugins/nginx-helper/faq/ for more details-->
    And here is another loader.io test result with it (also configured nginx level redis & redis object cache, nginx helper and removed another WP Plugins);

    [​IMG]

    Unfortunately my supercache vs redis nginx level + redis object cache results ratio 10/1 and redis gave me many 500, many network and many timeout errors.

    Still what I missed, what's the trick of behind your results @eva2000 (n)
     
  7. eva2000

    eva2000 Administrator Staff Member

    30,902
    6,908
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,404
    Local Time:
    7:47 AM
    Nginx 1.13.x
    MariaDB 5.5
    Probably need more tweaking and troubleshooting. but that is left to end user yourself to do :)

    Start with lower user concurrency comparisons instead of 10k concurrent and work your way up.
     
  8. AKIN SENOL

    AKIN SENOL Member

    36
    3
    8
    Oct 17, 2014
    London
    Ratings:
    +8
    Local Time:
    9:47 PM
    1.9.12
    10.1.12
    Well but redis-cli --intrinsic-latency 10 output "Worst run took 767x longer than the average latency." but yours "Worst run took 35x longer than the average latency.".How it's possible with same configuration @eva2000 ?
     
  9. eva2000

    eva2000 Administrator Staff Member

    30,902
    6,908
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,404
    Local Time:
    7:47 AM
    Nginx 1.13.x
    MariaDB 5.5
    Only wp and nginx redis is the same configuration. However, the rest of the server still needs tuning and that part is left to end users. Centmin Mod provides the framework and structured base.. but end user still needs to optimize the rest to get that bit more out of their servers :) ;)
     
  10. AKIN SENOL

    AKIN SENOL Member

    36
    3
    8
    Oct 17, 2014
    London
    Ratings:
    +8
    Local Time:
    9:47 PM
    1.9.12
    10.1.12
    Thank you for all hard work @eva2000 Of course every server needs different scenario and also tweak.

    I just learning, reading, testing some newly technologies and most of these with this forum. So do you advice fastcgi with redis object cache or ngx level redis with cluster?
     
  11. eva2000

    eva2000 Administrator Staff Member

    30,902
    6,908
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,404
    Local Time:
    7:47 AM
    Nginx 1.13.x
    MariaDB 5.5
    For wordpress, fastcgi_cache would be faster than redis nginx level caching when both properly setup. However, I find redis nginx level caching a bit easier to setup especially if you're automating it via centmin.sh menu options eventually.
     
    • Agree Agree x 1
    • Friendly Friendly x 1
  12. AKIN SENOL

    AKIN SENOL Member

    36
    3
    8
    Oct 17, 2014
    London
    Ratings:
    +8
    Local Time:
    9:47 PM
    1.9.12
    10.1.12
    Yes, I automating it via centmin.sh 22. option and it's much better now. Espacially wpincludes seperation & #comments are very comfortable for me.

    I'm working on WPMU and fastcgi bit more complex like as you saying. Also around the web has very basic and copy/paste informations about WPMU nginx.

    If I achieved that with new wpincludes hierarchy, I would be happy like to share with community.

    With redis nginx level caching I'm not getting errors in log files to understand why it's not handled for achieve that. I just learned redis can handle 10000 connect with single socket.