Hi Willy.  The "balance url_param" looks like what I need.

In regards to setting a cookie, in my case each of the http clients is actually 
an email fetching worker calling an imap api which will eventually sit behind 
HAProxy.  Because each api node will have a connection pool of imap 
connections, depending on which email address the worker is processing, i want 
the request to be directed to the server which already has a pool of 
connections open for that email address.  If i didn't do this, the more api 
nodes behind HAProxy, the more connections i will have open to the imap server 
and imap limits open connections to each email account.  Each worker will be 
serving multiple email accounts and workers will process the same email account 
in parallel so i don't think the cookie based routing applies to this use case 
(but i could be wrong).

Is there significant overhead in the url_param hashing algorithm?  Will the 
load be spread evenly across all nodes?  Also, in the case of node failure, 
will the "balance url_param" pick another node?

Thanks for your help!

-karl


On Sep 12, 2010, at 4:19 PM, Willy Tarreau wrote:

> Hello Karl,
> 
> On Wed, Sep 08, 2010 at 08:36:30PM -0400, Karl Baum wrote:
>> I am a beginner to haproxy meaning that i have never used it or any other 
>> load balancer before, but i wanted to get an idea of something was possible.
> 
> hey, welcome to a world where you'll do many things that you'll find
> dirty, but will do them anyway because you can ;-)
> 
>> I would like to have sticky sessions based on only the value of a http 
>> request parameter such that if two different clients with the same request 
>> parameter make a request to the server, both requests will be handled by the 
>> same node.  
>> 
>> Let me know if that makes sense.
> 
> Yes that makes sense. It is possible to hash a request parameter and
> select a server based on the result. Check "balance url_param" in the
> doc for more information.
> 
> Also, usually stickiness involves cookies. Haproxy can insert (or even
> modify) a cookie in a response to note the server that handled the request.
> That way, when the client comes back, it knows what server to forward the
> request to. Maybe this is possible in your case and you don't need the
> url_param ?
> 
> Regards,
> Willy
> 


Reply via email to