I have been using varnish for a particular web blog/forum app, so far it is working well, except that forum users get confused when they delete or add a post and do not see the changed page immediately; so they either double-click (meaning a duplicate post) or try to delete something that has already been deleted.

In any case, the first rule is "don't confuse the user", so since I have trained the users to expect one kind of behavior I can't expect them to automatically adjust to a different behavior.

I ended up commenting out the vcl_fetch routine in the default vcl.conf and setting default_ttl to 15 seconds on the command line. Basically this is almost disabling the cache (hits are 10% or so).

Based on my reading, what I think will work best, is to set default_ttl to a very low value like 5 seconds, then use a regexp to specify explicitly what should be cached.

This works because what I want to cache are the .css, .gif, .jpg, .swf, .mp3 files - since virtually all the actual HTML is dynamically generated out of a database, simply off-loading the delivery of other files is the key thing I want varnish to do.

e.g. "if filename ends in .gif|.jpg|.css|.mp3 add to cache and set timeout to 600 seconds" ; otherwise default_ttl at 5 seconds will expire the page and eliminate double-clicks and double-deletes.

Can I put a regexp in the vcl_fetch routine? Just add something like this to the stock vcl.conf:

sub vcl_fetch {
       if (req.url  - "/.css|.gif|.jpg|.mp3|.swf/") {

             # force minimum ttl of 600 seconds (mod from orig. 180s)

                      if (obj.ttl < 600s) {
                  set obj.ttl = 600s;
                  }
             }
}

I am sure I have the syntax wrong, and the regular expression is wrong; but I think I am clear on what I am trying to do.

Cordially
Patrick Giagnocavo
[EMAIL PROTECTED]

_______________________________________________
varnish-misc mailing list
[email protected]
http://projects.linpro.no/mailman/listinfo/varnish-misc

Reply via email to