Mailing List Archive

Load balancing?
Hi,

I remember there were discussions about possible HTTP load balancing
features in Varnish, but I don't know what was the result. Does Varnish
support load balancing (even simple round-robin would be enough, IP
address hashing would be better)?

If not, does anyone has a recommendation about a nice and stable load
balancer (ideally, it would also have an integrated HTTP accelerator to
reduce the number of components to maintain in the system)?


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 250 bytes
Desc: OpenPGP digital signature
Url : http://projects.linpro.no/pipermail/varnish-misc/attachments/20080117/e294544a/attachment.pgp
Load balancing? [ In reply to ]
Hi,

We have just built us a function in PHP to load balance the images between 4
varnish servers. This function will always assign the same image to a server
every time. It doesn't select a random server. So the cache is distributed
across our 4 servers.

// Get varnish server path
function get_varnish_path($path) {
return 'http://'.$GLOBALS['servers'][crc32($path) %
count($GLOBALS['servers'])].$path;
}

// Varnish servers
$servers[] = 'varnish1.site.com';
$servers[] = 'varnish2.site.com';
$servers[] = 'varnish3.site.com';
$servers[] = 'varnish4.site.com';

// Example
print get_varnish_path('/image1.jpg').' ';
print get_varnish_path('/image12.jpg').' ';
print get_varnish_path('/image54.jpg').' ';
print get_varnish_path('/image488.jpg').' ';
print get_varnish_path('/image1.jpg').' ';

// Result
http://varnish4.site.com/image1.jpg
http://varnish1.site.com/image12.jpg
http://varnish3.site.com/image54.jpg
http://varnish1.site.com/image488.jpg
http://varnish4.site.com/image1.jpg

Fredrik Kristiansen
Nettby.no

On 17/01/2008, Ivan Voras <ivoras at fer.hr> wrote:
>
> Hi,
>
> I remember there were discussions about possible HTTP load balancing
> features in Varnish, but I don't know what was the result. Does Varnish
> support load balancing (even simple round-robin would be enough, IP
> address hashing would be better)?
>
> If not, does anyone has a recommendation about a nice and stable load
> balancer (ideally, it would also have an integrated HTTP accelerator to
> reduce the number of components to maintain in the system)?
>
>
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at projects.linpro.no
> http://projects.linpro.no/mailman/listinfo/varnish-misc
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.linpro.no/pipermail/varnish-misc/attachments/20080117/f375f059/attachment.htm
Load balancing? [ In reply to ]
Check out this page:

http://varnish.projects.linpro.no/wiki/Backends

This feature is only available in /trunk currently. So you'll have to
download the source from SVN.

I also agree about hashing. I'm not currently using varnish in full
production, but i'm worried that when I do, the round robin mode will
cause my clients to loose session information if/when they get
directed to a different backend server.

It would be great to have a sourcehash mode, where a specific IP would
always get directed to the same backend server as long as that backend
is up and functioning.

On Jan 17, 2008 8:35 AM, Ivan Voras <ivoras at fer.hr> wrote:
> Hi,
>
> I remember there were discussions about possible HTTP load balancing
> features in Varnish, but I don't know what was the result. Does Varnish
> support load balancing (even simple round-robin would be enough, IP
> address hashing would be better)?
>
> If not, does anyone has a recommendation about a nice and stable load
> balancer (ideally, it would also have an integrated HTTP accelerator to
> reduce the number of components to maintain in the system)?
>
>
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at projects.linpro.no
> http://projects.linpro.no/mailman/listinfo/varnish-misc
>
>
Load balancing? [ In reply to ]
In message <33afbbe70801171341w37171c26od4780a263bd17b8f at mail.gmail.com>, "Cale
b Anthony" writes:

>Check out this page:
>
>http://varnish.projects.linpro.no/wiki/Backends
>
>This feature is only available in /trunk currently. So you'll have to
>download the source from SVN.

I'm not sure that core is entirely ready to be used, I have an audit
of it on my list.

With respect to client-backend-affinity, I plan to add a soft version
of that, more about that later.

--
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.
Load balancing? [ In reply to ]
You're right. I should have mentioned that /trunk is of course
bleeding-edge and may not be entirely stable for production use.

I look forward to what you have to say about client affinity.

On Jan 18, 2008 1:12 AM, Poul-Henning Kamp <phk at phk.freebsd.dk> wrote:
> In message <33afbbe70801171341w37171c26od4780a263bd17b8f at mail.gmail.com>, "Cale
> b Anthony" writes:
>
> >Check out this page:
> >
> >http://varnish.projects.linpro.no/wiki/Backends
> >
> >This feature is only available in /trunk currently. So you'll have to
> >download the source from SVN.
>
> I'm not sure that core is entirely ready to be used, I have an audit
> of it on my list.
>
> With respect to client-backend-affinity, I plan to add a soft version
> of that, more about that later.
>
> --
> 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.
>