How to duplicate cached data on all Varnish instance?

Sascha Ottolski ottolski at web.de
Tue Feb 19 17:58:50 CET 2013


Am Dienstag, 19. Februar 2013, 19:44:53 schrieb Xianzhe Wang:
> Here I take nginx as a load balancer and it contects 2 varnish severs.
> I wanna share the cache object between 2 varnishes.
> When one varnish is down, the left one will work fine, and the cache
> object is still work.
> Is there anything I can do for this?
> 
> I aslo saw an  example something like this:
> https://www.varnish-cache.org/trac/wiki/VCLExampleHashIgnoreBusy
> But i think it will increase network delay. So I don't want do it like
> this.
> 
> Is someone can share their experience? Thanks a lot.
> 
> Shawn

I would say, you already have your solution. If nginx send the requests 
randomly to any of the two servers, each will obviously fill its cache; 
so if one goes down, the other is still there. The two caches may not be 
completely identically, depending on the size of your cacheable content, 
but each should be "warm" enough to serve most requests from its cache. 

And you're not limited to two varnish servers, of course. The more you 
put into your loadbalanced cluster, the lower the impact if one fails.

Cheers

Sascha



More information about the varnish-misc mailing list