Re: domain based load balancing

2012-12-06 Thread Willy Tarreau
On Thu, Dec 06, 2012 at 01:45:51PM -0500, Daniel Alfonso wrote:
> balance hdr(host)
> 
> it would round robin but sticky anything with the same value to first server 
> to get the request for that domain

more precisely it would not round robin, it would hash the value of the
Host header, and use the result to select a server.

Regards,
Willy




RE: domain based load balancing

2012-12-06 Thread Daniel Alfonso
balance hdr(host)

it would round robin but sticky anything with the same value to first server to 
get the request for that domain

-Original Message-
From: Alexandre Biancalana [mailto:biancal...@gmail.com] 
Sent: Thursday, December 6, 2012 12:51 PM
To: Willy Tarreau
Cc: Daniel Alfonso; haproxy@formilux.org
Subject: Re: domain based load balancing

Hi Willy,

  Thank you for that great software !

On Wed, Dec 5, 2012 at 8:11 PM, Willy Tarreau  wrote:
>
>> Is there a better way of accomplishing this?
>
> Have you thought about hashing the Host header (for example) ? Just an 
> idea, I don't know how that fits your need.

Can you give an example of that idea ?

Regards,
Alexandre



Re: domain based load balancing

2012-12-06 Thread Alexandre Biancalana
Hi Willy,

  Thank you for that great software !

On Wed, Dec 5, 2012 at 8:11 PM, Willy Tarreau  wrote:
>
>> Is there a better way of accomplishing this?
>
> Have you thought about hashing the Host header (for example) ? Just an
> idea, I don't know how that fits your need.

Can you give an example of that idea ?

Regards,
Alexandre



Re: domain based load balancing

2012-12-06 Thread Willy Tarreau
On Thu, Dec 06, 2012 at 04:55:42PM +0100, Baptiste wrote:
> you could specify your domain across multiple lines:
> acl foo hdr(Host) name1 name2
> acl foo hdr(Host) name3 name4
> etc...
> 
> a logical OR is applied if ACLs share the same name.

And if there are *that* many, load them from a file, it will be more
manageable :

   acl foo hdr(Host) -f names.txt

Cheers,
Willy




Re: domain based load balancing

2012-12-06 Thread Baptiste
you could specify your domain across multiple lines:
acl foo hdr(Host) name1 name2
acl foo hdr(Host) name3 name4
etc...

a logical OR is applied if ACLs share the same name.

cheers


On Thu, Dec 6, 2012 at 4:09 PM, Daniel Alfonso
 wrote:
> I can maintain it programmatically and was able to do it via hdr(dom) acl 
> match.
>
> I am running into an haproxy config limit of 2047 characters per line
>
> I'd like an acl to match a space delimited string of domains(potentially 
> hundreds). Any way to increase this limit? Is it an arbitrary limit imposed 
> by haproxy devs or is it a threshold that, if crossed, causes problems?
>
> -Danny
>
> -Original Message-
> From: Willy Tarreau [mailto:w...@1wt.eu]
> Sent: Wednesday, December 5, 2012 5:11 PM
> To: Daniel Alfonso
> Cc: haproxy@formilux.org
> Subject: Re: domain based load balancing
>
> Hi Daniel,
>
> On Wed, Dec 05, 2012 at 02:18:15PM -0500, Daniel Alfonso wrote:
>> Hello,
>>
>> I want to load balance hundreds (maybe thousands) of domains to a farm of 
>> web servers.
>>
>> I want each domain to only ever load on 1 webserver and stay there unless 
>> there is a failure.
>>
>> I'd like to break this up based on traffic load so all webservers are doing 
>> roughly the same work.
>>
>> Can this be done practically with just a ton of ACLs?
>
> Yes but maybe not much maintainable.
>
>> Is there a better way of accomplishing this?
>
> Have you thought about hashing the Host header (for example) ? Just an idea, 
> I don't know how that fits your need.
>
> Willy
>
>



RE: domain based load balancing

2012-12-06 Thread Daniel Alfonso
I can maintain it programmatically and was able to do it via hdr(dom) acl match.

I am running into an haproxy config limit of 2047 characters per line

I'd like an acl to match a space delimited string of domains(potentially 
hundreds). Any way to increase this limit? Is it an arbitrary limit imposed by 
haproxy devs or is it a threshold that, if crossed, causes problems?

-Danny

-Original Message-
From: Willy Tarreau [mailto:w...@1wt.eu] 
Sent: Wednesday, December 5, 2012 5:11 PM
To: Daniel Alfonso
Cc: haproxy@formilux.org
Subject: Re: domain based load balancing

Hi Daniel,

On Wed, Dec 05, 2012 at 02:18:15PM -0500, Daniel Alfonso wrote:
> Hello,
> 
> I want to load balance hundreds (maybe thousands) of domains to a farm of web 
> servers.
> 
> I want each domain to only ever load on 1 webserver and stay there unless 
> there is a failure.
> 
> I'd like to break this up based on traffic load so all webservers are doing 
> roughly the same work.
> 
> Can this be done practically with just a ton of ACLs?

Yes but maybe not much maintainable.

> Is there a better way of accomplishing this?

Have you thought about hashing the Host header (for example) ? Just an idea, I 
don't know how that fits your need.

Willy




Re: domain based load balancing

2012-12-05 Thread Willy Tarreau
Hi Daniel,

On Wed, Dec 05, 2012 at 02:18:15PM -0500, Daniel Alfonso wrote:
> Hello,
> 
> I want to load balance hundreds (maybe thousands) of domains to a farm of web 
> servers.
> 
> I want each domain to only ever load on 1 webserver and stay there unless 
> there is a failure.
> 
> I'd like to break this up based on traffic load so all webservers are doing 
> roughly the same work.
> 
> Can this be done practically with just a ton of ACLs?

Yes but maybe not much maintainable.

> Is there a better way of accomplishing this?

Have you thought about hashing the Host header (for example) ? Just an
idea, I don't know how that fits your need.

Willy