Varnish Dirty Caching

Christoph varnish at held-im-ruhestand.de
Mon Jul 2 23:14:50 CEST 2007


hi,

i'd like to implement dirty-caching using varnish.

So what is dirty caching and why use it? Think of a very unreliable
backend. If varnish can't reach it's backend, it will simply return the
last content it has (even if the content is stale). That way i can cover
hickups.

Is this possible? What are the side effects?




As far as i understood varnish the "normal" configurations works like
this

request comes in

try to find it in cache

if obj.cacheable (missing documentation on the exact meaning of
cacheable, probably a check is Expires Header is still in the future) then 
return this object to client (will this update the age header?)

fetch object from backend. If cacheable insert into cache.

Return object to client.



Now after some time comes the reaper. If an object expired the reaper
will call vcl_timeout. vcl_timeout will either discard the object, or it
will fetch an update. 
If i discard it on timeout, this will keep my cache tidy. If i always
fetch an update it will constantly keep a complete copy of my backend
(at least the part that was hit once). Both options seem bad. Keeping it
tidy will force a complete retrieval of the object, even if it didn't
change on the backend (just new expire headers). Keeping a copy will
hammer my backend with requests for files that are normaly hit every ten
years. 

so i'm slightly confused and looking for some documentation...


Greetings
   Christoph



More information about the varnish-misc mailing list