Re: balance source based on a X-Forwarded-For

2009-04-16 Thread Jeff Simpson
Assuming this feature does what I think, then it's particularly useful 
for scenarios like mine where stickiness on host is used to group users 
on the same physical box.  I've got a video conference app that requires 
users on the same box to correctly multiplex video streams and provide 
push notifications to groups of users associated with one another.  
There are other ways to group users, of course, but our app uses hosts 
to create non-overlapping usernames (i.e. joe @ foo.blah.com is 
different than j...@blah.blah.com).


Benoit, thanks!  I'll try this patch today when I get to the office.

-Jeff

John L. Singleton wrote:
It's all in little gains, we have some site like example.fr, 
example.com, sub.example.fr
that in fact runs to the same directory. Doing this (the balance on 
host header) help
the efficiency of the whole system, the 'use_domain_only' is just a 
potential small gain
but if a small bit of code can potentially reduce the backend load 
why not ?


As for the apache instance with virtual hosting, i don't see your 
point here.
Our backend server are apache server, with mod_rewrite based 
virtualhost to allow
easier update of the domain to directory mapping and an application 
servers.


There is file caching on the system side, on the application server 
side and just doing that

reduce by two to three the average response time of a page.



Ah, okay, I see. Thanks for the clarification. Caching is where I saw 
something like this coming in handy---my other comment was something 
like, caching aside, why would we care how the requests are 
distributed over instances where users are likely to not use all of 
the domains/tlds? Like, if I am reading the english version of a page, 
I likely speak English and won't do something like flip over to the 
French version, thusly I would never get to take advantage of this 
option. But in the case of caching assets, yes, I do see the point. Neat.



John L. Singleton
jsing...@gmail.com



On Mar 29, 2009, at 1:33 PM, benoit wrote:



It's all in little gains, we have some site like example.fr, 
example.com, sub.example.fr
that in fact runs to the same directory. Doing this (the balance on 
host header) help
the efficiency of the whole system, the 'use_domain_only' is just a 
potential small gain
but if a small bit of code can potentially reduce the backend load 
why not ?


As for the apache instance with virtual hosting, i don't see your 
point here.
Our backend server are apache server, with mod_rewrite based 
virtualhost to allow
easier update of the domain to directory mapping and an application 
servers.


There is file caching on the system side, on the application server 
side and just doing that

reduce by two to three the average response time of a page.

John L. Singleton a écrit :
I'm a little mystified as to the usefulness of this as well. I mean, 
what does hashing the domain name solve that just balancing back to 
a bunch of Apache instances with virtual hosting turned on doesn't? 
Are you saying that you have domains like en.example.com, 
fr.example.com and you want them all to be sticky to the same 
backend server when they balance? If that's the case, I could see 
that being useful if the site in question were doing some sort of 
expensive per-user asset generation that was being cached on the 
server. Is this what you are talking about?



John L. Singleton
jsing...@gmail.com mailto:jsing...@gmail.com




On Mar 29, 2009, at 9:05 AM, Jeffrey 'jf' Lim wrote:

On Wed, Mar 25, 2009 at 8:02 PM, Benoit maver...@maverick.eu.org 
mailto:maver...@maverick.eu.org wrote:



diff -ru haproxy-1.3.15.7/doc/configuration.txt 
haproxy-1.3.15.7-cur/doc/configuration.txt
--- haproxy-1.3.15.7/doc/configuration.txt  2008-12-04 
11:29:13.0 +0100
+++ haproxy-1.3.15.7-cur/doc/configuration.txt  2009-02-24 
16:17:19.0 +0100

@@ -788,6 +788,19 @@

   balance url_param param [check_post [max_wait]]

+  header  The Http Header specified in argument will be 
looked up in

+  each HTTP request.
+
+  With the Host header name, an optionnal 
use_domain_only
+  parameter is available, for reducing the hash 
algorithm to
+  the main domain part, eg for haproxy.1wt.eu, 
only 1wt

+  will be taken into consideration.
+


I'm not so sure how balancing based on a hash of the Host header would
be useful. How would this be useful? I would see an application for
balancing on perhaps other headers (like xff as mentioned), but for
Host... I dunno... (so basically what I'm saying is, is the code for
the 'use_domain_only' bit useful? can it be left out?)

-jf

--
In the meantime, here is your PSA:
It's so hard to write a graphics driver that open-sourcing it 
would not help.

  -- Andrew Fear, Software Product Manager, NVIDIA Corporation
http://kerneltrap.org/node/7228













Re: balance source based on a X-Forwarded-For

2009-03-29 Thread Jeffrey 'jf' Lim
On Wed, Mar 25, 2009 at 8:02 PM, Benoit maver...@maverick.eu.org wrote:


 diff -ru haproxy-1.3.15.7/doc/configuration.txt 
 haproxy-1.3.15.7-cur/doc/configuration.txt
 --- haproxy-1.3.15.7/doc/configuration.txt      2008-12-04 11:29:13.0 
 +0100
 +++ haproxy-1.3.15.7-cur/doc/configuration.txt  2009-02-24 16:17:19.0 
 +0100
 @@ -788,6 +788,19 @@

                 balance url_param param [check_post [max_wait]]

 +      header      The Http Header specified in argument will be looked up in
 +                  each HTTP request.
 +
 +                  With the Host header name, an optionnal use_domain_only
 +                  parameter is available, for reducing the hash algorithm to
 +                  the main domain part, eg for haproxy.1wt.eu, only 1wt
 +                  will be taken into consideration.
 +

I'm not so sure how balancing based on a hash of the Host header would
be useful. How would this be useful? I would see an application for
balancing on perhaps other headers (like xff as mentioned), but for
Host... I dunno... (so basically what I'm saying is, is the code for
the 'use_domain_only' bit useful? can it be left out?)

-jf

--
In the meantime, here is your PSA:
It's so hard to write a graphics driver that open-sourcing it would not help.
-- Andrew Fear, Software Product Manager, NVIDIA Corporation
http://kerneltrap.org/node/7228



Re: balance source based on a X-Forwarded-For

2009-03-29 Thread benoit

Jeffrey 'jf' Lim a écrit :

On Wed, Mar 25, 2009 at 8:02 PM, Benoit maver...@maverick.eu.org wrote:
  

diff -ru haproxy-1.3.15.7/doc/configuration.txt 
haproxy-1.3.15.7-cur/doc/configuration.txt
--- haproxy-1.3.15.7/doc/configuration.txt  2008-12-04 11:29:13.0 
+0100
+++ haproxy-1.3.15.7-cur/doc/configuration.txt  2009-02-24 16:17:19.0 
+0100
@@ -788,6 +788,19 @@

balance url_param param [check_post [max_wait]]

+  header  The Http Header specified in argument will be looked up in
+  each HTTP request.
+
+  With the Host header name, an optionnal use_domain_only
+  parameter is available, for reducing the hash algorithm to
+  the main domain part, eg for haproxy.1wt.eu, only 1wt
+  will be taken into consideration.
+



I'm not so sure how balancing based on a hash of the Host header would
be useful. How would this be useful? I would see an application for
balancing on perhaps other headers (like xff as mentioned), but for
Host... I dunno... (so basically what I'm saying is, is the code for
the 'use_domain_only' bit useful? can it be left out?)

-jf

Well, at least it's usefull for our business, it's why it's here :)
It's aimed at a shared hosting environmen, with multiple host
entry pointing to differents web sites. The objective was to
maximise caching efficiency and response times by 'sticking'
a site to a backend server. The use_domain_only was here to
reduce the hashing to the most significative part and help with
site using many tld for language selection.



Re: balance source based on a X-Forwarded-For

2009-03-29 Thread Willy Tarreau
On Sun, Mar 29, 2009 at 07:46:05PM +0200, benoit wrote:
 Jeffrey 'jf' Lim a écrit :
 On Wed, Mar 25, 2009 at 8:02 PM, Benoit maver...@maverick.eu.org wrote:
   
 diff -ru haproxy-1.3.15.7/doc/configuration.txt 
 haproxy-1.3.15.7-cur/doc/configuration.txt
 --- haproxy-1.3.15.7/doc/configuration.txt  2008-12-04 
 11:29:13.0 +0100
 +++ haproxy-1.3.15.7-cur/doc/configuration.txt  2009-02-24 
 16:17:19.0 +0100
 @@ -788,6 +788,19 @@
 
 balance url_param param [check_post [max_wait]]
 
 +  header  The Http Header specified in argument will be looked 
 up in
 +  each HTTP request.
 +
 +  With the Host header name, an optionnal 
 use_domain_only
 +  parameter is available, for reducing the hash 
 algorithm to
 +  the main domain part, eg for haproxy.1wt.eu, only 
 1wt
 +  will be taken into consideration.
 +
 
 
 I'm not so sure how balancing based on a hash of the Host header would
 be useful. How would this be useful? I would see an application for
 balancing on perhaps other headers (like xff as mentioned), but for
 Host... I dunno... (so basically what I'm saying is, is the code for
 the 'use_domain_only' bit useful? can it be left out?)
 
 -jf
 Well, at least it's usefull for our business, it's why it's here :)
 It's aimed at a shared hosting environmen, with multiple host
 entry pointing to differents web sites. The objective was to
 maximise caching efficiency and response times by 'sticking'
 a site to a backend server. The use_domain_only was here to
 reduce the hashing to the most significative part and help with
 site using many tld for language selection.

BTW Benoit, be careful, you left some fprintf() in your patch.

Regards,
Willy




Re: balance source based on a X-Forwarded-For

2009-03-29 Thread John L. Singleton
I'm a little mystified as to the usefulness of this as well. I mean,  
what does hashing the domain name solve that just balancing back to a  
bunch of Apache instances with virtual hosting turned on doesn't? Are  
you saying that you have domains like en.example.com, fr.example.com  
and you want them all to be sticky to the same backend server when  
they balance? If that's the case, I could see that being useful if the  
site in question were doing some sort of expensive per-user asset  
generation that was being cached on the server. Is this what you are  
talking about?



John L. Singleton
jsing...@gmail.com




On Mar 29, 2009, at 9:05 AM, Jeffrey 'jf' Lim wrote:

On Wed, Mar 25, 2009 at 8:02 PM, Benoit maver...@maverick.eu.org  
wrote:



diff -ru haproxy-1.3.15.7/doc/configuration.txt haproxy-1.3.15.7- 
cur/doc/configuration.txt
--- haproxy-1.3.15.7/doc/configuration.txt  2008-12-04  
11:29:13.0 +0100
+++ haproxy-1.3.15.7-cur/doc/configuration.txt  2009-02-24  
16:17:19.0 +0100

@@ -788,6 +788,19 @@

balance url_param param [check_post [max_wait]]

+  header  The Http Header specified in argument will be  
looked up in

+  each HTTP request.
+
+  With the Host header name, an optionnal  
use_domain_only
+  parameter is available, for reducing the hash  
algorithm to
+  the main domain part, eg for haproxy.1wt.eu,  
only 1wt

+  will be taken into consideration.
+


I'm not so sure how balancing based on a hash of the Host header would
be useful. How would this be useful? I would see an application for
balancing on perhaps other headers (like xff as mentioned), but for
Host... I dunno... (so basically what I'm saying is, is the code for
the 'use_domain_only' bit useful? can it be left out?)

-jf

--
In the meantime, here is your PSA:
It's so hard to write a graphics driver that open-sourcing it would  
not help.

   -- Andrew Fear, Software Product Manager, NVIDIA Corporation
http://kerneltrap.org/node/7228





Re: balance source based on a X-Forwarded-For

2009-03-29 Thread Willy Tarreau
On Sun, Mar 29, 2009 at 12:31:27PM -0700, John L. Singleton wrote:
 I'm a little mystified as to the usefulness of this as well. I mean,  
 what does hashing the domain name solve that just balancing back to a  
 bunch of Apache instances with virtual hosting turned on doesn't? Are  
 you saying that you have domains like en.example.com, fr.example.com  
 and you want them all to be sticky to the same backend server when  
 they balance? If that's the case, I could see that being useful if the  
 site in question were doing some sort of expensive per-user asset  
 generation that was being cached on the server. Is this what you are  
 talking about?

There are proxies which can do prefetching, and in this case, it's
desirable that all requests for a same domain name pass through the
same cache.

Regards,
Willy




Re: balance source based on a X-Forwarded-For

2009-03-29 Thread benoit

Willy Tarreau a écrit :

On Sun, Mar 29, 2009 at 07:46:05PM +0200, benoit wrote:
  

Jeffrey 'jf' Lim a écrit :


On Wed, Mar 25, 2009 at 8:02 PM, Benoit maver...@maverick.eu.org wrote:
 
  
diff -ru haproxy-1.3.15.7/doc/configuration.txt 
haproxy-1.3.15.7-cur/doc/configuration.txt
--- haproxy-1.3.15.7/doc/configuration.txt  2008-12-04 
11:29:13.0 +0100
+++ haproxy-1.3.15.7-cur/doc/configuration.txt  2009-02-24 
16:17:19.0 +0100

@@ -788,6 +788,19 @@

   balance url_param param [check_post [max_wait]]

+  header  The Http Header specified in argument will be looked 
up in

+  each HTTP request.
+
+  With the Host header name, an optionnal 
use_domain_only
+  parameter is available, for reducing the hash 
algorithm to
+  the main domain part, eg for haproxy.1wt.eu, only 
1wt

+  will be taken into consideration.
+
   


I'm not so sure how balancing based on a hash of the Host header would
be useful. How would this be useful? I would see an application for
balancing on perhaps other headers (like xff as mentioned), but for
Host... I dunno... (so basically what I'm saying is, is the code for
the 'use_domain_only' bit useful? can it be left out?)

-jf
  

Well, at least it's usefull for our business, it's why it's here :)
It's aimed at a shared hosting environmen, with multiple host
entry pointing to differents web sites. The objective was to
maximise caching efficiency and response times by 'sticking'
a site to a backend server. The use_domain_only was here to
reduce the hashing to the most significative part and help with
site using many tld for language selection.



BTW Benoit, be careful, you left some fprintf() in your patch.

Regards,
Willy

  

Heck yes, i'll have to check on this thanks.

Btw, why isn't this list set with a default reply to the list ?




Re: balance source based on a X-Forwarded-For

2009-03-29 Thread Willy Tarreau
On Sun, Mar 29, 2009 at 10:17:39PM +0200, benoit wrote:
 BTW Benoit, be careful, you left some fprintf() in your patch.
 
 Regards,
 Willy
 
   
 Heck yes, i'll have to check on this thanks.
 
You're welcome.

 Btw, why isn't this list set with a default reply to the list ?

Because I hate it when responses to my messages only go to the
list. I can't permanently check all the lists I'm subscribed to,
and I find it a lot better that people involved in a discussion
are kept CCed. However, IIRC the list does not change the reply-to
header, so anyone is free to set it to the list and will not get
direct copies when people hit reply-to-all.

Willy




Re: balance source based on a X-Forwarded-For

2009-03-29 Thread Jeffrey 'jf' Lim
On Mon, Mar 30, 2009 at 3:48 AM, Willy Tarreau w...@1wt.eu wrote:
 On Sun, Mar 29, 2009 at 12:31:27PM -0700, John L. Singleton wrote:
 I'm a little mystified as to the usefulness of this as well. I mean,
 what does hashing the domain name solve that just balancing back to a
 bunch of Apache instances with virtual hosting turned on doesn't? Are
 you saying that you have domains like en.example.com, fr.example.com
 and you want them all to be sticky to the same backend server when
 they balance? If that's the case, I could see that being useful if the
 site in question were doing some sort of expensive per-user asset
 generation that was being cached on the server. Is this what you are
 talking about?

 There are proxies which can do prefetching, and in this case, it's
 desirable that all requests for a same domain name pass through the
 same cache.


so are you saying haproxy - cache - backend? (in which case, you
would be talking more about an ISP, i think? or does anybody here not
running an ISP actually do this (I would be interested to know))

-jf

--
In the meantime, here is your PSA:
It's so hard to write a graphics driver that open-sourcing it would not help.
-- Andrew Fear, Software Product Manager, NVIDIA Corporation
http://kerneltrap.org/node/7228