forget an object in vcl_fetch

David Birdsong david.birdsong at gmail.com
Fri Nov 13 09:10:01 CET 2009


Is it possible to make varnish completely forget an object in
vcl_fetch?  In thinking about a tiered setup, I'm trying to figure how
I can capture the very tip of my traffic with a varnish running with
abundant random read capacity and ethernet such that it never
lru_nukes or expires an object which I've noticed can cause random
read performance to plummet on the devices housing the storage file.
(

So say in a backend varnish I set a header when it's obj.hits >
100000.  The downstream varnish looks for this header, if it's not
present it sets obj.cacheable to false in vcl_fetch.

For example, upstream (closer to backend) varnish:
sub vcl_deliver {
  if (obj.hits > 100000 ) {
    set resp.http.X-Super-Hot-File = "1";
  }

In the downstream (closer to client) varnish:

sub vcl_fetch {
  if (!beresp.X-Super-Hot-File) {
    unset obj.cacheable;
  }
}

or maybe instead ...
sub vcl_fetch {
  if (!beresp.X-Super-Hot-File) {
   obj.ttl = 0s;
  }
}

Would this work?  Will this allow me to pass massive amounts of
traffic through varnish without dirtying pages and in turn driving up
iowait on slow devices that back the mmap'd storage file?



More information about the varnish-misc mailing list