Thanks Baptiste for your reply, but I think this is not a health check problem. Let me give you a very simplified example of the problem. Let's assume the following transactions are sent to the aforementioned configuration with W1 = 3, W2=1, W3=1,W4=1:/MYURL/MYURL /MYURL /OtherURL BK1 will forward the first three "/MYURL" transactions to go to the Server Web1 (W=3);Now, when it comes to " /OtherURL", regardless of the other "/MYURL" transactions that are currently processing in Web1, BK2 will forward this new " /OtherURL" transaction to Web1, while it could send it to Web2 as it is least loaded server at the moment. BK2 is selecting the least loaded server internally without any information from BK1. This is a very simplified format of the issue. Because of such behaviour, HAProxy is not able to provide optimum performance. As I understood from the code, those three structure that keeps track of which server is the one that should be select as the next target is kept in each backend separately, and this raises the issue for such a config. I need to make change either in my config, or most probably in the code to make this happen. But for me as new user, it was complex to figure out what changes I need to do to fix this. Any help is appreciated. From: Baptiste <[email protected]> To: N P <[email protected]> Cc: "[email protected]" <[email protected]> Sent: Tuesday, June 2, 2015 12:48 PM Subject: Re: Global least loaded server On Tue, Jun 2, 2015 at 6:36 PM, N P <[email protected]> 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). Note that, same servers are used > in the backends with different weights. > 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. > > > 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. > > > My setting is: > > backend BK1 > balance leastconn > server web1 000.000.000.000:00 weight W1 > server web2 111.111.111.111:11 weight W2 > > backend BK2 > balance leastconn > server web1 000.000.000.000:00 weight W3 > server web2 111.111.111.111:11 weight W4 > > > frontend http > bind *:80 > mode http > acl myACL url_beg /MYURL > use_backend BK1 if myACL > default_backend BK2
Hi, Your health checks should be able to report an overloaded server, or better, using the agent-check for this purpose. Baptiste

