Strategies for splitting load across varnish instances? And avoiding single-point-of-failure?
pub crawler
pubcrawler.com at gmail.com
Sat Jan 16 16:38:14 CET 2010
Poul, is anyone running the hash director distribution method like
you provided (in production)?
What sort of throughput and what sort of use limitations has anyone
experienced with this?
This is quite exciting - and seems like a fairly good solution to
scale/cluster Varnish.
-Paul
> You can do some clever stuff with the hash director to distribute the
> content over a cluster of varnishes:
>
> varnish1 has:
>
> backend webserver {...}
> backend varnish2 {...}
> backend varnish3 {...}
>
> acl partner {
> "varnish1 ip"
> "varnish2 ip"
> "varnish3 ip"
> }
>
> director h1 hash {
> { .backend webserver; .weight 1; }
> { .backend varnish2; .weight 1; }
> { .backend varnish3; .weight 1; }
> }
>
> sub vcl_fetch {
> if (beresp.http.x-partner == "yes") {
> set beresp.ttl = 0s;
> unset beresp.http.x-partner;
> }
> }
>
> sub vcl_deliver {
> if (client.ip ~ partner) {
> set resp.http.x-partner = yes;
> }
> }
>
> On varnish2 you change the "h1" director to read:
>
> director h1 hash {
> { .backend varnish1; .weight 1; }
> { .backend webserver; .weight 1; }
> { .backend varnish3; .weight 1; }
> }
>
> On varnish3:
>
> director h1 hash {
> { .backend varnish1; .weight 1; }
> { .backend varnish2; .weight 1; }
> { .backend webserver; .weight 1; }
> }
>
> --
> Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
> phk at FreeBSD.ORG | TCP/IP since RFC 956
> FreeBSD committer | BSD since 4.3-tahoe
> Never attribute to malice what can adequately be explained by incompetence.
>
More information about the varnish-misc
mailing list