Thank for reply Willy. On Fri, May 23, 2014 at 10:42 PM, Willy Tarreau <[email protected]> wrote:
> On Fri, May 23, 2014 at 09:54:18PM +0530, Jai Gupta wrote: > > We have configured haproxy 1.5 and are using map-based hash (default). > > > > For e.g. we have two backend servers. Server A and Server B. > > Clients 1,2,3,4,5 will go to same backend. > > > > For example > > Client 1,2,3 are connected to Server A as per hash. > > Server A is crashed. > > haproxy shifts clients to Server B. > > Server A recovers. > > Client 4,5 are connected to Server A > > > > Problem is that 1,2,3 remain connected with Server B but as per updated > > hash, they should be connected with Server A. > > > > We want all clients 1,2,3,4,5 to be connected to same Server. > > > > Connection remain connected for very long time so either they need to be > > forcefully disconnected if hash changes or hash should be such that it > > honors already connected connections. > > > > What hash should we use in this case or is there any other configuration > > that we should be using? > > It's totally irrelevant to the hash here, because the hash is determinist > so it ensures that a given input always leads to the same choice of server > among a similar farm. The problem is that you're dealing with long > connections and that you want to kill them when server A goes back up. > > Haproxy can kill existing connections to backup servers when a server goes > up, but it does not kill connections to active servers. > We could be having hundreds of active servers. It would not be efficient to have few spare backup servers for each and every active server, we may also not be able to load balance in that approach. > What protocol are you using ? Does it transparently support connections > being killed every time a server goes up ? I'm asking because that's a > bit of a mess for the users, you'll reduce reliability by adding more > servers... And if the protocol supports having connections killed, then > you'd rather simply reduce the timeout so that they disappear sooner. > Protocol used is websocket and it is supposed to be connected for hours. Our challenge is to keep all clients with given group attached to one server, we can't let them spread between multiple servers. We aim for both HA and load balancing. Do we have a way out haproxy could provide? > Regards > Willy >

