using parallel varnishes
Ken Brownfield
kb+varnish at slide.com
Thu Jun 17 20:50:14 CEST 2010
Seems like that will do the job.
You might also want to look into the consistent hash of haproxy, which should provide cache "distribution" over an arbitrary pool. Doing it in varnish would get pretty complicated as you add more varnishes, and the infinite loop potential is a little unnerving (to me anyway :)
We wanted redundant caches in a similar way (but for boxes with ~1T of cache) and set up a test config with haproxy that seems to work, but we haven't put real-world load on it yet.
--
Ken
On Jun 17, 2010, at 6:54 AM, Martin Boer wrote:
> Hello all,
>
> I want to have 2 servers running varnish in parallel so that if one fails the other still contains all cacheable data and the backend servers won't be overloaded.
> Could someone check to see if I'm on the right track ?
>
> This is how I figure it should be working.
> I don't know how large 'weight' can be, but with varnish caching > 90% that impact would be affordable.
> Regards,
> Martin Boer
>
>
> director via_other_varnish random {
> .retries = 5;
> {
> .backend = other_server;
> .weight = 9;
> }
> # use the regular backends if the other varnish instance fails.
> {
> .backend = backend_1;
> .weight = 1;
> }
> {
> .backend = backend_2;
> .weight = 1;
> }
> {
> .backend = backend_3;
> .weight = 1;
> }
> }
>
> director via_backends random {
> {
> .backend = backend_1;
> .weight = 1;
> }
> {
> .backend = backend_2;
> .weight = 1;
> }
> {
> .backend = backend_3;
> .weight = 1;
> }
> }
>
>
> sub vcl_recv {
> if ( resp.http.X-through-varnish > 0 ) {
> # other varnish forwarded the request already
> # so forward to backends
> set req.backend = via_backends;
> remove resp.http.X-through-varnish;
> } else {
> # try the other varnish
> resp.http.X-through-varnish = 1;
> set req.backend = via_other_varnish;
> }
> ..
>
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> http://lists.varnish-cache.org/mailman/listinfo/varnish-misc
More information about the varnish-misc
mailing list