HAProxy community

Knowing administrative state (MAINT/DRAIN/...) backend-side


Is it possible for the backend to know that connections to it are being drained so that it could start gracefully closing persistent connections?

The use case is as follows:

  • the LB is in TCP mode (loadbalancing SSL connections that have to be end2end)
  • the application has an auxiliary HTTP port specifically for LB-side health-checks
  • want to gracefully remove one backend server from load-balancing (not affecting any client connections)
  • backend app uses persistent connections (http keep-alive)

The problem:

  • Even though LB enters DRAIN mode, persistent connections may never terminate while there is traffic on them.

It looks like one of the potential solutions would be to tell the backend application to start gracefully dropping persistent connections (essentially, start replying ‘Connection: close’).

Question being:
How can the backend find out that it should end persistent connections?
http-check send-state seems like a good fit, but the only information the backend receives is the operational state (UP/DOWN/NOLB).
Is it possible to get the administrative state (MAINT/DRAIN) in the health-check request header as well?

Thanks in advance


Hi, Any ideas?
I.e. if using http-check is not the way to go, how do you typically tackle graceful node detach when running in L4 and the app uses persistent connections?

Or - what would it take to extend http-check send-state to include extra info?