HAProxy – How to Change Backend When Reaching maxconn

haproxy

I have just started using HAProxy, and I am building a real-time chat application. I wonder if it is possible to send clients to another backend when the current backend reaches its maxconn (I am using "balance source"). Because sometimes, when a backend reaches its limit, all the connections to that backend are queued and the browser keeps loading while other backends are free.

Best Answer

I don't know, but try this in the backend configuration (adapt 10 with your maxconn) :

acl too_many be_sess_rate gt 10
use_backend b_too_many if too_many be_sess_rate
Related Topic