Hey all,
I wanted to have an http balance algorithm whose logic is similiar
to the following:
1) use the left most part of the uri before the ? up to depth N. If the
value at the depth of N (meaning the characters between the slashes at
that depth) is anything other than the number zero, use a hash of the
value at that depth only to compute which server receives the request.
2) If the above is not met (meaning there was no value at that depth OR
the value there was the number zero), then look for the url parameter Y
and use it's value as the hash on where to send the request. If this
url paramter does not exist, use a round robin algorithm.
From my reading of the docs, one cannot do this today, correct? If
true, I think the simplest way to implement this would be to support
multiple balance statements where the second one is used if the first is
not met (rather than RR after the first). I also think I'd need a
change to use only the character at depth N for the first part (rather
than everything before and including that depth).
The basic background is that the http requests I want to balance have a
user id at depth N for all requests (hence why I want to hash based on
that value only). Sometimes, there is no user, in which case we want to
hash on the parameter (Which is essentially a unique identifier for the
anonymous user accessing the system at this moment. One of driving
forces behind this scheme includes the fact that we can get hit with
multiple simultaneous http requests across multiple different haproxy
instances that we want routed to the same server before we have a chance
to generate a cookie for the client to send up on subsequent requests
(which we then use to ensure that user stays at that server in light of
servers going in and out of service). We are running 1.4.10 on linux
ubuntu 10.04 and do not wish to jump on the development 1.5.x branch
quite yet.
Thanks for any thoughts on the best way to do this. I have to say we've
been using haproxy for some very elaborate internal load balancing and
it has been remarkably functional and stable for us.
greg
- multiple balance statements Gregory Scallan
-