On Sat, May 24, 2014 at 08:23:04AM +0530, Jai Gupta wrote:
> > > 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.

OK.

> > 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?

OK so you don't need to switch back and forth between servers within the
same group then ? Wouldn't it be better to stick users to the "current"
server instead ? That is, incoming connections start to go to a server,
whatever it is, and if it fails, then everyone switches to the other one,
and remain on it until it dies ? This is easy to do using a stick table,
just stick on anything (typically a constant) and the last server will be
reminded. Example :

      backend blah
          mode http
          balance roundrobin 
          stick-table type int size 1 expire 1d
          stick on always_true   # just a constant
          default-server on-marked-down shutdown-sessions
          server srv1 1.1.1.1:80 check
          server srv2 1.1.1.2:80 check

etc...

Willy


Reply via email to