Hello,

On Tue, Jun 02, 2015 at 04:36:59PM +0000, N P wrote:
> Hi,
> I want to send two transactions with different weights to different servers.
> I have done this using frontend, backend, and ACL as can be seen from the
> below config.The other requirement is to also use leastconn balancing.
> 
> The problem is that in this setting, leastconn applies within each backend
> and the selected server is not essentially the GLOBAL least loaded server in
> total (maybe due to a bug in the system).

It's not a bug, it's by design : haproxy doesn't know that what looks
like the same server in different backends is in fact the same. What
you need is something that's been for a long time in the roadmap but
never implemented, which is an identifier of a shared server that we
could specify on a server (eg: "server xxx ... same-as bk1/srv2".

> Note that, same servers are used in
> the backends with different weights.

It doesn't make much sense to consider the servers' load *and* have
different weights in each backend in my opinion, since the weight
is applied to the connection count.


> From what I understood from the code, the
> problem seems to be that each backend tracks the number of connection of its
> own servers separately. Therefore, although a server is overloaded in one
> backend, the other backend might think that it is completely free.

That's exactly the case.

> My requirement is to forward requests to different servers with different
> weights, but select the least loaded server in total. I
> checked Haproxy code to see what I need to change, but could not figure it
> out. I am not very familiar with HAProxy code and structure. I wonder if
> there is an easy solution to do this, or if some one can help me with some
> directions to do this; either to config HAProxydifferently or to change its
> code to address my requirement.Any help is appreciated.

Just a stupid question : what prevents you from using the same backend ?
Usually that's what people do. Is there a reason a server would appear
up in one backend and down in another one ?

There could be a solution using the agent check : you can deploy an agent
on the servers to modulate the weight based on the local connection count,
though it could be a bit difficult.

Therefore I think that using a single backend would be much simpler.

Willy


Reply via email to