Want more timely Centmin Mod News Updates?
Become a Member

Wordpress Redis X-Cache miss

Discussion in 'Blogs & CMS usage' started by JarylW, May 5, 2016.

  1. JarylW

    JarylW Active Member

    213
    39
    28
    Jun 19, 2014
    Singapore
    Ratings:
    +99
    Local Time:
    11:40 AM
    Is there any concern for

    Code:
    X-Cache: MISS
    X-Cache-2: BYPASS
    
    The nginx helper plugin timestamp shows that the page is cached though - what causes the header to reflect miss?
     
  2. eva2000

    eva2000 Administrator Staff Member

    29,031
    6,589
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,782
    Local Time:
    1:40 PM
    Nginx 1.13.x
    MariaDB 5.5
    see Wordpress - Redis Cache at Nginx Level + WP Super Cache | Centmin Mod Community
    That's normal as there's only 2 possible outputs for $srcache_store_status BYPASS or STORE. Where STORE only happens when a subrequest isn't available in Redis cache and has status codes 200, 301 or 302 i.e. when $srcache_fetch_status = MISS. Once, $srcache_fetch_status = HIT, then $srcache_store_status becomes BYPASS as it doesn't have to to store the subrequest in Redis cache.

    see openresty/srcache-nginx-module · GitHub

    and openresty/srcache-nginx-module · GitHub
     
  3. JarylW

    JarylW Active Member

    213
    39
    28
    Jun 19, 2014
    Singapore
    Ratings:
    +99
    Local Time:
    11:40 AM
    It does not show HIT though, it shows miss & bypass regardless of whether the page stays cached or not (verified by timestamp printed by nginx helper)
     
  4. eva2000

    eva2000 Administrator Staff Member

    29,031
    6,589
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,782
    Local Time:
    1:40 PM
    Nginx 1.13.x
    MariaDB 5.5
  5. JarylW

    JarylW Active Member

    213
    39
    28
    Jun 19, 2014
    Singapore
    Ratings:
    +99
    Local Time:
    11:40 AM
    Test default on new installation, uncomment redis.confs and commented cache enabler.

    I am not sure what you mean?

    Haven't enabled that will check and revert soon.

    Yea, if I wasn't logged out even the timestamp will reflect that the cache is being regenerated everytime. It is not being regenerated (i.e. it is cached properly but header state miss & bypass)
     
  6. eva2000

    eva2000 Administrator Staff Member

    29,031
    6,589
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,782
    Local Time:
    1:40 PM
    Nginx 1.13.x
    MariaDB 5.5
    still good to see the vhost conf as a second pair of eyes may reveal stuff :)

    siege benchmark with/without redis cache enabled etc

    you using centmin mod 123.09beta01 which has those include files for redis already created on centmin.sh menu option 22 auto install and setup of wordpress ?

    i.e. php-rediscache.conf setup at centminmod/wpsetup.inc at 123.09beta01 · centminmod/centminmod · GitHub

    did you do all steps Redis - How to install Redis server on Centmin Mod LEMP stack | Centmin Mod Community for try_files too ? and commenting out instances of php-wpsc.conf
    Code (Text):
    include /usr/local/nginx/conf/php-wpsc.conf;

    and uncommenting instances of php-rediscache.conf
    Code (Text):
    #include /usr/local/nginx/conf/php-rediscache.conf;
     
  7. JarylW

    JarylW Active Member

    213
    39
    28
    Jun 19, 2014
    Singapore
    Ratings:
    +99
    Local Time:
    11:40 AM
    Sure.

    Code:
    # Centmin Mod Getting Started Guide
    # must read http://centminmod.com/getstarted.html
    
    # redirect from non-www to www
    # uncomment, save file and restart Nginx to enable
    # if unsure use return 302 before using return 301
    #server {
    #            listen   80;
    #            server_name sgcws.cf;
    #            return 301 $scheme://www.sgcws.cf$request_uri;
    #       }
    
    server {
      server_name sgcws.cf www.sgcws.cf;
    
    # 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/sgcws.cf/log/access.log combined buffer=256k flush=60m;
      error_log /home/nginx/domains/sgcws.cf/log/error.log;
    
      root /home/nginx/domains/sgcws.cf/public;
      # 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/wpincludes/sgcws.cf/wpcacheenabler_sgcws.cf.conf;
      #include /usr/local/nginx/conf/wpincludes/sgcws.cf/wpsupercache_sgcws.cf.conf;
      # https://community.centminmod.com/posts/18828/
      include /usr/local/nginx/conf/wpincludes/sgcws.cf/rediscache_sgcws.cf.conf; 
    
      location / {
      include /usr/local/nginx/conf/503include-only.conf;
    
      # 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;
    
      }
    
    location ~* /(wp-login\.php) {
        limit_req zone=xwplogin burst=1 nodelay;
        #limit_conn xwpconlimit 30;
        ##auth_basic "Private";
        #auth_basic_user_file /home/nginx/domains/sgcws.cf/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/sgcws.cf/wpsecure_sgcws.cf.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;
    }
    
    Yes is from beta which already includes redis (commented) stuff
     
  8. eva2000

    eva2000 Administrator Staff Member

    29,031
    6,589
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,782
    Local Time:
    1:40 PM
    Nginx 1.13.x
    MariaDB 5.5
    looks pretty spot on with exception of removing
    Code (Text):
      # prevent access to ./directories and files
      location ~ (?:^|/)\. {
       deny all;
      }
    

    Though shouldn't make a difference.

    confirmation via phpredisadmin cache entry inspection and siege/benchmarking would confirm if it's working for redis caching at nginx level for wordpress