HAProxy Session Persistence v.s. Drain State

Hi,
I think you want to read this blog article, it’s old, but its content is still pretty accurate:

Using a “deterministic” LB algorithm (like the hash you mentionned) does not work with “drain” mode. That said, if you enable cookie or stick table based persistence, then the following happens:

  • if a new user comes in, he will be routed to any server in the backend but the ones in DRAIN mode
  • if a user comes with a persistence information pointing to a server in DRAIN mode, then HAProxy will route this user to the server (unless the server is set as DOWN by the health check of course)

It’s not a “persistent TCP connection”, it’s more a HTTP based session persistence, so all the traffic from a single user will be routed to a server in drain mode.

Note that the log line from HAProxy will have some very useful persistence flags too.

1 Like