Sharing a cache between multiple Varnish servers

Neil Saunders n.j.saunders at gmail.com
Sat Apr 21 15:29:53 CEST 2012


Sent from my iPhone

On 21 Apr 2012, at 12:09, Jonathan Matthews <contact at jpluscplusm.com> wrote:

> On 21 April 2012 09:25, Neil Saunders <n.j.saunders at gmail.com> wrote:
>> Hi all -
>>
>> A two part question on cache sharing:
>>
>> a) I've got 3 web servers each with a 3.5Gb memory cache. I'd like them to
>> share a cache but don't want to use the experimental persistant storage
>> backend - Are there any other options?
>
> As Per's said, this isn't possible.
>
>> b) We run a cache warming script to ensure a certain set of URL's are always
>> cached, but at the moment the script requests to all 3 web heads to ensure
>> cache consistency - I see that Varnish supports PUT operations - Would it be
>> feasible for the cache warmer to request content from webhead 1 and make a
>> "PUT request to servers 2 & 3? I've searched high and low for documentation
>> on this but can't find anything.
>
> If Per's suggestion of hashing content across the caches doesn't fit
> in with what you're trying to do, how about this.
>
> Put some logic in your VCL that looks out for a "X-Cache-Warming:
> True" (or whatever) request header, which your warming script will
> explicitly set.
>
> If this header is present, then use VCL to get Varnish to switch over
> to another cache as its backend such that, instead of just going
> cache1->origin, the request instead goes
> cache1->cache2->cache3->origin. You'll need this logic on N-1 of your
> caches (the last one doesn't need to know it's part of this scheme) ,
> and it should enable you to make 1 request to warm N caches.
>
> You might even be able abstract this so it works for cache flushes,
> too, and not just warming operations.
>
> HTH,
> Jonathan
> --
> Jonathan Matthews
> Oxford, London, UK
> http://www.jpluscplusm.com/contact.html
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

Excellent suggestions-Thank you both.



More information about the varnish-misc mailing list