It sounds like balance url_param is exactly what i need.  In regards to a node 
going down, hash-type consistent sounds great as i would like to keep my 
clients using the same node if it is still available.

Thanks for your help!

-karl


On Sep 15, 2010, at 3:34 AM, Willy Tarreau wrote:

> On Mon, Sep 13, 2010 at 08:06:37AM -0400, Karl Baum wrote:
>> 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).
> 
> OK, so what you describe perfectly matches the typical usage of a URL
> parameter hash.
> 
>> Is there significant overhead in the url_param hashing algorithm?
> 
> No, it's still quite cheap. You should not notice it on a mailing system.
> 
>> Will the load be spread evenly across all nodes?
> 
> yes, the hashing algorithm used tends to be quite smooth, but for that
> you obviously need a somewhat large population. I'd say that if your
> number of possible keys is about 100 times bigger than the number of
> nodes, you'll get quite a smooth distribution.
> 
>> Also, in the case of node failure, will the "balance url_param" pick another 
>> node?
> 
> Yes, that's the same for all algorithms, provided that you enable health
> checks of course. The point to note with hashing algorithms is that when
> a node goes down, the farm size changes and everyone gets redispatched.
> This may or may not be desired. If this is a problem, you could use
> "hash-type consistent" to change the hashing algorithm to a consistent
> one : only the users of the failed node will be uniformly redispatched
> to remaining nodes. The downside is that consistent hashing is not as
> smooth at the normal one, but it might still be acceptable in your case.
> 
> Regards,
> Willy
> 


Reply via email to