Load Balancing Strategy FIFO

Hello,

Is it possible to setup HAProxy to use load balancing strategy FIFO? What that means is supposed that I have 3 backend servers: A, B, and C.

  • It will load balance to A first
  • If A is down, then will load balance to B and when A comes back up, it will be added to the end of the line.
  • If B is down, then it will load balance to C and when B comes back up, it will be added to the end of the line
  • At any time, all successful connections will only go to the same server

Thanks.

Use the backup keyword allong with -on-marked-* :

http://cbonte.github.io/haproxy-dconv/2.4/configuration.html#5.2-backup
http://cbonte.github.io/haproxy-dconv/2.4/configuration.html#5.2-on-marked-down
http://cbonte.github.io/haproxy-dconv/2.4/configuration.html#5.2-on-marked-up

However, when the primary server comes back up, servers will go back to that one.

That is not useful then. If A comes backup, existing connections will stay in B and new connections will go to A. Whenever a server goes back online, it must go to the end of the queue hence FIFO.

At any time, all successful connection will only go to the same server

That’s why we have, like previously mentioned:

on-marked-down shutdown-sessions on-marked-up shutdown-backup-sessions

This is currently not an option.

This is possible and very common, with the configuration mentioned above.

I think you are mistaken. If A goes down, some clients will connect to B; once A comes back up, new clients will connect to A and existing connections still stay connected to B.

How does that meet my requirements that at any times, successful connections only goto the same server? When some are connected to B and some connected to A (when it came back up).

Just want a clarification; if you use on-marked-up shutdown-backup-sessions, how long is the delay? Will there be any time when both servers (A and B) can have connected clients?

Also, if you designate B and C as backup; and if A goes down, then B gets all the connections; if B also goes down, will C gets all the connection? And if B comes back up? Will both B & C get connections? Only when A comes back online, then connections on B & C get terminated and re-connected to A?

No, on-marked-up shutdown-backup-sessions will kill existing connections to B.

There is no delay.

No.

Yes.

B will get the connections, and connections on C would be terminated.

Yes.

The use-case of the shutdown-backup-sessions and shutdown-sessions features is to have all connections on one server. If there is a situation where this is not the case, then it’s a bug.