[Wordpress]homepage not purging (Everton Blair)

Enno van Amerongen enno at tty.nl
Sat Jul 9 11:29:47 CEST 2011


use a far shorter ttl, 10-15 mins is way too much, use something like 10 seconds or even less. that will result in max 0.1 req/sec on your backend, I doubt that's a problem.


Enno


  _____  

From: Everton Blair [mailto:everton at connectedinternet.co.uk]
To: Stewart Robinson [mailto:stewsnooze at gmail.com]
Cc: varnish-misc at varnish-cache.org [mailto:varnish-misc at varnish-cache.org]
Sent: Fri, 08 Jul 2011 22:11:07 +0200
Subject: Re: [Wordpress]homepage not purging (Everton Blair)

Hi Stewart


Really appreciate you replying and trying to help as this has been driving me mad!


Caching the homepage for a shorter period is a potentially a good idea, and I could I guess set it to purge say every 10-15 minutes, so it'd only be one 'unlucky' person who would see an uncached page every 10-15 mins.  Not ideal, but it'd work.  It'd be even better if I could purge the page and then somehow prime the cache again automatically with the page.    





On Fri, Jul 8, 2011 at 8:49 PM, Stewart Robinson <stewsnooze at gmail.com> wrote:
    







On 8 Jul 2011, at 20:16, Everton Blair <everton at connectedinternet.co.uk> wrote:
    

  
sorry, I meant to say new posts ARE NOT forcing the homepage to purge/update, so I need a way to get the homepage to update whenever any purge request comes in.


On Fri, Jul 8, 2011 at 8:05 PM,  <varnish-misc-request at varnish-cache.org> wrote:
          Send varnish-misc mailing list submissions to
          varnish-misc at varnish-cache.org
  
  To subscribe or unsubscribe via the World Wide Web, visit
          https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
        or, via email, send a message with subject or body 'help' to
          varnish-misc-request at varnish-cache.org
  
  You can reach the person managing the list at
          varnish-misc-owner at varnish-cache.org
  
  When replying, please edit your Subject line so it is more specific
  than "Re: Contents of varnish-misc digest..."
  
  
  Today's Topics:
  
     1. Re: Drupal 7.x & Varnish 3.x (Flatcircle)
     2. Varnish + Apache + SSL + Pound? (Scott Wilcox)
     3. Re:[Wordpress]homepage not purging (Everton Blair) (Everton Blair)
  
  
  ----------------------------------------------------------------------
  
  Message: 1
  Date: Fri, 8 Jul 2011 20:26:18 +0200
  From: Flatcircle <flatcircle at hotmail.com>
  To: Mattias Geniar <mattias at nucleus.be>
  Cc: varnish-misc at varnish-cache.org
  Subject: Re: Drupal 7.x & Varnish 3.x
  Message-ID: <BLU0-SMTP1768BBF60304167604DF611C2400 at phx.gbl>
  Content-Type: text/plain; charset="us-ascii"
  
  An HTML attachment was scrubbed...
  URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20110708/7af63846/attachment-0001.html>
            
  ------------------------------
  
  Message: 2
  Date: Fri, 8 Jul 2011 19:37:38 +0100
  From: Scott Wilcox <scott at dor.ky>
  To: <varnish-misc at varnish-cache.org>
  Subject: Varnish + Apache + SSL + Pound?
  Message-ID: <2F426C39-48D0-4D7A-A14C-4BBCA9391837 at dor.ky>
      Content-Type: text/plain; charset="us-ascii"
  
  Hello folks,
  
  I've seen this and similar questions asked often and with varying replies. I'd like to have my own scenario looked at. I'm currently in the process of redesigning my work flow for one of my projects. The main web server that serves content is Apache. I plan to have Varnish caching this traffic where applicable. I would like to add a layer of redundancy in regards to alerting users of problems too. I also need to support SSL too.
            
  I'm looking at having pound accept connections which is then passed to varnish. Varnish then handles the traffic as normal.
  
  I've seen in v3 that basic HTML can be output for errors, but I'd like to include a stylesheet and logo too. I can host these off the site if needed, but I've considered having 'pretty' error messages which include stylesheets and images. I'd obviously have to host these off site which isn't a problem.
            
  Is it better to use nginx to accept both HTTP and HTTPS connections and serve the errors/content or does my original plan sound better?
  
  What do you use in production and why?
  
  Do you recommend pound or nginx?
  
  Many thanks for replies in advance.
  
  --
  Scott Wilcox
  
  @dordotky | scott at dor.ky | http://dor.ky
      +44 (0) 7538 842418 | +1 (646) 827-0580
  
  -------------- next part --------------
  An HTML attachment was scrubbed...
  URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20110708/ced5f362/attachment-0001.html>
            
  ------------------------------
  
  Message: 3
  Date: Fri, 8 Jul 2011 20:04:40 +0100
  From: Everton Blair <everton at connectedinternet.co.uk>
  To: varnish-misc at varnish-cache.org
  Subject: Re:[Wordpress]homepage not purging (Everton Blair)
  Message-ID:
          <CAOAN0RQEraiGv9e8K3jTsAuM3YOdgAyBK8iahHZBcZY1sfFTdw at mail.gmail.com>
        Content-Type: text/plain; charset="iso-8859-1"
  
  Can anyone help me with my problem please?  It's been causing me major
  problems.  Basically I'm using Wordpress and new posts have been forcing the
  homepage to purge, I think because I'm using a special template within
  wordpress to create the homepage and I think Varnish doesn't realise it
  needs to purge that page
  
  What I want to do is force varnish to purge my homepage when any purge
  requests come in to make sure it stays fresh and to be safe, but I can't get
  this to work:
  
  sub vcl_recv {
   if (req.request == "PURGE") {
              if (!client.ip ~ purge) {
                  error 405 "Not allowed.";
                  }
  if (req.url == "^windows7news.com/$") {
  purge(HOW DO I TELL VARNISH TO PURGE
  http://www.windows7news.com/magazine-homepage/ ????);
   }
  if (req.url == "^windows8news.com/$") {
   purge(HOW DO I TELL VARNISH TO PURGE
  http://www.windows8news.com/magazine-homepage/ ???);
   }
  return(lookup);
          }
  }
  
  Thanks for any help.
  
  
  On Fri, Jul 8, 2011 at 11:46 AM, <varnish-misc-request at varnish-cache.org>wrote:
      
  > Send varnish-misc mailing list submissions to
  >        varnish-misc at varnish-cache.org
  >
  > To subscribe or unsubscribe via the World Wide Web, visit
  >        https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
        > or, via email, send a message with subject or body 'help' to
  >        varnish-misc-request at varnish-cache.org
  >
  > You can reach the person managing the list at
  >        varnish-misc-owner at varnish-cache.org
  >
  > When replying, please edit your Subject line so it is more specific
  > than "Re: Contents of varnish-misc digest..."
  >
  >
  > Today's Topics:
  >
  >   1. Re: Does Varnish uses ETag? (Geoff Simmons)
  >   2. Fwd: [Wordpress]homepage not purging (Everton Blair)
  >   3. Re: errno = Connection reset by peer (Tollef Fog Heen)
  >   4. Re: Varnishstat question (Tollef Fog Heen)
  >   5. Possible bug with very large headers in varnish-3.0.0
  >      revision 3bd5997 (Lee Trout)
  >
  >
  > ----------------------------------------------------------------------
  >
  > Message: 1
  > Date: Fri, 08 Jul 2011 12:23:54 +0200
  > From: Geoff Simmons <geoff at uplex.de>
  > To: Kurt Kraut <listas at kurtkraut.net>
  > Cc: varnish-misc at varnish-cache.org
  > Subject: Re: Does Varnish uses ETag?
  > Message-ID: <4E16DABA.2050606 at uplex.de>
  > Content-Type: text/plain; charset=ISO-8859-1
  >
  > -----BEGIN PGP SIGNED MESSAGE-----
  > Hash: SHA256
  >
  > On 7/7/11 11:14 PM, Kurt Kraut wrote:
  > >
  > > Does Varnish used ETag to check cache freshness?
  >
  > Mainline Varnish doesn't, but there's an experimental branch
  > 'experimental-ims' on the source repository in which it's implemented.
  >
  > > - If yes, how does it behave?
  >
  > http://www.varnish-cache.org/trac/wiki/BackendConditionalRequests
        >
  > As per the RFC, freshness checks against ETags are done with conditional
  > requests to the backend using If-None-Match.
  >
  > > - If not, is it possible to achive through VCL?
  >
  > I don't think so, because standard VCL doesn't have a way to access an
  > object in the cache that has an expired TTL, but otherwise matches the
  > request, and hence could be refreshed.
  >
  > So you don't ordinarily know an ETag in VCL that could be used for the
  > refresh, and even if you did, and got a 304 response from the backend,
  > there's no way to tell Varnish to deliver the stale object after all.
  >
  > If you get a chance to try the IMS branch, please let us know how it goes.
  >
  >
  > Best,
  > Geoff
  > - --
  > UPLEX Systemoptimierung
  > Schwanenwik 24
  > 22087 Hamburg
  > http://uplex.de/
  > Mob: +49-176-63690917
  > -----BEGIN PGP SIGNATURE-----
  > Version: GnuPG/MacGPG2 v2.0.14 (Darwin)
  > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
  >
  > iQIcBAEBCAAGBQJOFtq5AAoJEOUwvh9pJNURIy4QAKPiZ05kblNGfw7RFJo5Z9fg
  > 81feHHYKRy880yJrG9up8wNx02+9uku6gNlYkpkPcQqfP/fZu5PpUtjGK7pmCSWG
  > Jv0bBEL+j5V2L0SaQtoxyyvBkQ5bjQcmrZnuxpYRKRdZeNpjIWY1BLHjMkC3z+sS
  > 4KKPi1aiGTKYQH8O1FZHz+6dfP8OQseUCs7tLwYM2BYF2onh5H81ys/Adp6520lv
  > WV2cJWKJO85MqH5C0qmyzGV3ovTFPaU3J4/4idzPxW/vbUDozr5/XjloG7IYzCi6
  > Hj5YrfoJlqBREqdAdZ46G/cxS4dKmvMWIO8XaJIYMBISDaXQysXfLq9vLiqODD5l
  > /1/ijFfEWihwdoxJ/xi1ZgxhA8RYuxQQCMtStVch+QiHpp8ROw04GutXFmA67JeM
  > aWIBt9WL/cXc/YSP2geSobY89/ROulnKcqV9n5xvxGe1L2bkwq1jQJTtINF6l1oC
  > lBb9tZAA2JGEeJi8Fv9lcjcrMiLSPzoW16rbzpQNjxxu129Rq8ntteFkm5cqM4sD
  > 2do8CvRO3YauIY6bUGhRVSjNHCvYf6HvvoZEoKvgJy5drziKyU3qx3WEq3TF+QQU
  > q+Em6WhiYHQufj6OGnZCFJJ4SKDNUNzBkwzuoXay6jxvUtv3m1tGJyKMK0rYN7vv
  > 24e8axxNjKucDr5uFx1L
  > =PW5G
  > -----END PGP SIGNATURE-----
  >
  >
  >
  > ------------------------------
  >
  > Message: 2
  > Date: Fri, 8 Jul 2011 11:38:57 +0100
  > From: Everton Blair <everton at connectedinternet.co.uk>
  > To: varnish-misc at varnish-cache.org
  > Subject: Fwd: [Wordpress]homepage not purging
  > Message-ID:
  >        <CAOAN0RTbMwwiYOTiZZcHA+h7HXYkDut7NLE_+c_ef=CCDxm4Xw at mail.gmail.com
  > >
  > Content-Type: text/plain; charset="iso-8859-1"
  >
  > Hi
  >
  > I've just started using Varnish with Wordpress/W3TC, and all is ok, apart
  > from my homepage not purging when an update is made e.g. a new post.  I
  > think this might be because my homepage is using a static page
  > www.windows7news.com/magazine-homepage/ as it's homepage and is doing some
        > magic within Wordpress to show this page when the page
  > www.windows7news.com/is requested i.e. the server doesn't know that
  > www.windows7news.com/magazine-homepage/ needs purging.
  >
  > I thought I'd temporariliy managed to fix this by adding:
  >
  > sub vcl_recv {
  >       if (req.url ~ "^/") {
  >               return(pass);
  >            }
  > }
  >
  > But I only managed to turn the cache off completely.  Is there anyway to
  > tell Varnish to always purge the homepage if there's a change?
  >
  > Thanks in advance for any help.
  >
  > My full VCL is below.  If anyone has any Wordpress specific changes they'd
  > like to share then please send them my way!
  >
  >  Regards
  >
  > EB
  >
  >
  > -----------------------------------------------------------------------------------------------------------------------------------
  >
  > backend b96_30_20_4 {
  > .host = "96.30.20.4";
  > .port = "8080";
  > .probe = {
  >                .url = "/";
  >                .interval = 5s;
  >                .timeout = 1 s;
  >                .window = 5;
  >                .threshold = 3;
  >  }
  > // we include time outs so uploads don't time out
  >  .connect_timeout = 600s;
  >  .first_byte_timeout = 600s;
  >  .between_bytes_timeout = 600s;
  > }
  >
  > backend b96_30_20_5 {
  > .host = "96.30.20.5";
  > .port = "8080";
  > .probe = {
  >                .url = "/";
  >                .interval = 5s;
  >                .timeout = 1 s;
  >                .window = 5;
  >                .threshold = 3;
  >  }
  > // we include time outs so uploads don't time out
  >  .connect_timeout = 600s;
  >  .first_byte_timeout = 600s;
  >  .between_bytes_timeout = 600s;
  > }
  >
  > backend b96_30_20_6 {
  > .host = "96.30.20.6";
  > .port = "8080";
  > .probe = {
  >                .url = "/";
  >                .interval = 5s;
  >                .timeout = 1 s;
  >                .window = 5;
  >                .threshold = 3;
  >  }
  > // we include time outs so uploads don't time out
  >  .connect_timeout = 600s;
  >  .first_byte_timeout = 600s;
  >  .between_bytes_timeout = 600s;
  > }
  >
  > backend b96_30_20_7 {
  > .host = "96.30.20.7";
  > .port = "8080";
  > .probe = {
  >                .url = "/";
  >                .interval = 5s;
  >                .timeout = 1 s;
  >                .window = 5;
  >                .threshold = 3;
  >  }
  > // we include time outs so uploads don't time out
  >  .connect_timeout = 600s;
  >  .first_byte_timeout = 600s;
  >  .between_bytes_timeout = 600s;
  > }
  >
  > backend b96_30_18_15 {
  > .host = "96.30.18.15";
  > .port = "8080";
  >  .probe = {
  >                .url = "/";
  >                .interval = 5s;
  >                .timeout = 1 s;
  >                .window = 5;
  >                .threshold = 3;
  >  }
  > // we include time outs so uploads don't time out
  >  .connect_timeout = 600s;
  >  .first_byte_timeout = 600s;
  >  .between_bytes_timeout = 600s;
  > }
  >
  > acl a96_30_20_4 {
  > "96.30.20.4";
  > }
  > acl a96_30_20_5 {
  > "96.30.20.5";
  > }
  > acl a96_30_20_6 {
  > "96.30.20.6";
  > }
  > acl a96_30_20_7 {
  > "96.30.20.7";
  > }
  > acl a96_30_18_15 {
  > "96.30.18.15";
  > }
  >
  > acl purge {
  >        "96.30.20.4";
  >  "96.30.20.5";
  > "96.30.20.6";
  > "96.30.20.7";
  >  "96.30.18.15";
  > }
  >
  > sub vcl_recv {
  > if (server.ip ~ a96_30_20_4) {
  >  set req.backend = b96_30_20_4;
  > }
  > if (server.ip ~ a96_30_20_5) {
  >  set req.backend = b96_30_20_5;
  > }
  > if (server.ip ~ a96_30_20_6) {
  >  set req.backend = b96_30_20_6;
  > }
  > if (server.ip ~ a96_30_20_7) {
  >  set req.backend = b96_30_20_7;
  > }
  > if (server.ip ~ a96_30_18_15) {
  >  set req.backend = b96_30_18_15;
  > }
  > }
  >
  > sub vcl_recv {
  >        if (req.request == "PURGE") {
  >                if (!client.ip ~ purge) {
  >                        error 405 "Not allowed.";
  >                }
  >                return(lookup);
  >        }
  > if (req.url ~ "^/") {
  >               return(pass);
  >            }
  > if (req.url ~ "^/forum/$") {
  >               return(pass);
  >            }
  > if (req.url ~ "^/$") {
  >               unset req.http.cookie;
  >            }
  > }
  > sub vcl_hit {
  >        if (req.request == "PURGE") {
  >                set obj.ttl = 0s;
  >                error 200 "Purged.";
  >        }
  > }
  > sub vcl_miss {
  >        if (req.request == "PURGE") {
  >                error 404 "Not in cache.";
  >        }
  > if (!(req.url ~ "wp-(login|admin)")) {
  >                 unset req.http.cookie;
  >                }
  >    if (req.url ~
  >
  > "^/[^?]+.(jpeg|jpg|png|gif|ico|js|css|txt|gz|zip|lzma|bz2|tgz|tbz|html|htm)(\?.|)$")
  > {
  >       unset req.http.cookie;
  >       set req.url = regsub(req.url, "\?.$", "");
  >    }
  >    if (req.url ~ "^/$") {
  >       unset req.http.cookie;
  >    }
  > }
  > sub vcl_fetch {
  >        if (req.url ~ "^/$") {
  >                unset beresp.http.set-cookie;
  >        }
  > if (!(req.url ~ "wp-(login|admin)")) {
  >                        unset beresp.http.set-cookie;
  > }
  > }
  > -------------- next part --------------
  > An HTML attachment was scrubbed...
  > URL: <
  > https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20110708/bf4bd761/attachment-0001.html
            > >
  >
  > ------------------------------
  >
  > Message: 3
  > Date: Fri, 08 Jul 2011 12:41:30 +0200
  > From: Tollef Fog Heen <tfheen at varnish-software.com>
  > To: google at alexus.org
  > Cc: varnish-misc at varnish-cache.org
  > Subject: Re: errno = Connection reset by peer
  > Message-ID: <8739iht5ph.fsf at qurzaw.varnish-software.com>
      > Content-Type: text/plain; charset=us-ascii
  >
  > ]] alexus
  >
  > |    70 Debug        c "Write error, retval = -1, len = 10212, errno =
  > | Connection reset by peer"
  > |
  > | other then vcl_error(404, unknown virtual host) what that other message
  > | really mean?
  >
  > That the client disconnected before we were done sending the object.
  >
  > --
  > Tollef Fog Heen
  > Varnish Software
  > t: +47 21 98 92 64
  >
  >
  >
  > ------------------------------
  >
  > Message: 4
  > Date: Fri, 08 Jul 2011 12:44:45 +0200
  > From: Tollef Fog Heen <tfheen at varnish-software.com>
  > To: Jonathan Hursey <jonathan.hursey at adrevolution.com>
  > Cc: varnish-misc at varnish-cache.org
  > Subject: Re: Varnishstat question
  > Message-ID: <87y609rqzm.fsf at qurzaw.varnish-software.com>
      > Content-Type: text/plain; charset=us-ascii
  >
  > ]] Jonathan Hursey
  >
  > Hi,
  >
  > | Greetings fellow varnish enthusiasts. I was wondering if anyone could
  > help
  > | me determine what would be considered good values for the follow fields
  > in
  > | varnishstat output and what these fields indicate:
  > |
  > |   1         0.00         0.00 N vcl total
  > |            1         0.00         0.00 N vcl available
  >
  > This just tells you that you have one VCL loaded.
  >
  > |            7          .            .   N total active purges
  > |            7         0.00         0.00 N new purges added
  >
  > You have 7 bans added
  >
  > |         6112         0.00         0.02 N objects tested
  >
  > And 6112 objects tested against those bans in total.
  >
  > Regards,
  > --
  > Tollef Fog Heen
  > Varnish Software
  > t: +47 21 98 92 64
  >
  >
  >
  > ------------------------------
  >
  > Message: 5
  > Date: Thu, 30 Jun 2011 20:44:26 -0400
  > From: Lee Trout <lee at leetrout.com>
  > To: varnish-misc at varnish-cache.org
  > Subject: Possible bug with very large headers in varnish-3.0.0
  >        revision 3bd5997
  > Message-ID: <BANLkTin7OC0zAFdedQQk3Mb42ozP=eVPwg at mail.gmail.com>
  > Content-Type: text/plain; charset=ISO-8859-1
  >
  > Hello!
  >
  > Please excuse the interruption, but I wanted to see if I may have
  > stumbled upon a bug or if there is a known issue or configuration
  > option for requests with very large header values.
  >
  > Using varnish-3.0.0 revision 3bd5997 when a large request comes in
  > (cookie header ~3k characters) the header is lost.  I am seeing
  > "LostHeader   c Cookie:" in the logs.
  >
  > This paste includes the request and results comparing varnish-3.0.0
  > revision 3bd5997 and varnish-2.1.4 SVN 5447M
  > http://pastebin.com/J2Qn0KGn
  >
  > Thank you in advance for your time and suggestions.
  >
  > Lee
  > --
  > Lee Trout
  > http://www.leetrout.com
  >
  >
  >
  > ------------------------------
  >
  > _______________________________________________
  > varnish-misc mailing list
  > varnish-misc at varnish-cache.org
  > https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
        >
  > End of varnish-misc Digest, Vol 64, Issue 13
  > ********************************************
  >
  -------------- next part --------------
  An HTML attachment was scrubbed...
  URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20110708/c40bf9ed/attachment.html>
            
  ------------------------------
  
  _______________________________________________
  varnish-misc mailing list
  varnish-misc at varnish-cache.org
  https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
        
  End of varnish-misc Digest, Vol 64, Issue 15
  ********************************************
  
  
_______________________________________________
varnish-misc mailing list
varnish-misc at varnish-cache.org
      https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

There is a separate tool called varnishadm that can regularly purge pages. Use that. Although you'll have to figure out how to trigger it on post. Alternatively can't you just cache the front page for only a minute or similar?      


Stew  
    
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20110709/8bf7d18b/attachment-0003.html>


More information about the varnish-misc mailing list