Sharing a cache between multiple Varnish servers

Neil Saunders n.j.saunders at gmail.com
Fri Apr 27 18:31:29 CEST 2012


On Sat, Apr 21, 2012 at 3:47 PM, Rainer Duffner <rainer at ultra-secure.de>wrote:

> Am Sat, 21 Apr 2012 09:25:06 +0100
> schrieb Neil Saunders <n.j.saunders at gmail.com>:
>
> > 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 think Java-software like ehcache (or some advanded derivative of
> it) can do that.
> But AFAIK, it requires close integration with the app that is cached.
> I don't think you can just bolt ehcache on top of stuff like you can do
> with varnish.
>
>
> Rainer
>

Hi all -

I've tried implementing the web server chaining suggested above but have
run in to a dead end. Broad configuration:

On all servers except the "last" in the chain I've defined:

backend next_web_server {
    .host = "webX.domain.com";
    .port = "80";
}

And have added the following to vcl_recv:

  if (req.http.X-Cache-Warming ~ "true") {
      set req.backend = next_web_server;
      set req.hash_always_miss = true;
      return(lookup);
  }

 set req.backend = system;
}

And have the following vcl_hash:

sub vcl_hash {

  hash_data(req.url);

  if (req.http.host)
 {
    hash_data(req.http.host);
 }

  return(hash);
}


My issue is that all "real" requests (i.e. those without the
X-Cache-Warming header following cache warming) are cache missing on all
web servers except the last one (The one thats actually going to the real
backend during cache warming) - It's like the backend name is being
explicitly hashed, but can't see anything that would indicate what's going
on in the documentation.

Any help appreciated!

Ta,

Neil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20120427/98af762f/attachment.html>


More information about the varnish-misc mailing list