Sharing a cache between multiple Varnish servers

Per Buer perbu at varnish-software.com
Sat Apr 21 12:36:02 CEST 2012


Hi Neil.


On Sat, Apr 21, 2012 at 10:25 AM, 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?
>

I don't think what you have in mind would work. Varnish requires an
explicit lock on the files in manages. Sharing a cache between Varnish
instances won't ever work.

What I would recommend you do  is to hash incoming requests based on URL so
each time the same URL is hit it is served from the same server. That way
you don't duplicate the content between caches. Varnish can do this, F5's
can do it, haproxy should be able to do this as well.

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.
>

No. Varnish requires a client requesting the data. But my solution above
would take care of that.

-- 
Per Buer
Phone: +47 21 98 92 61 / Mobile: +47 958 39 117 / Skype: per.buer
*Varnish makes websites fly!*
Whitepapers <http://www.varnish-software.com/whitepapers> |
Video<http://www.youtube.com/watch?v=x7t2Sp174eI> |
Twitter <https://twitter.com/varnishsoftware>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20120421/e665fba7/attachment.html>


More information about the varnish-misc mailing list