Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

up vote 0 down vote accepted

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
share|improve this answer

Try this, it will use another backend if current connection on frontend is greater than 20, change the number (line no 4) to suit with your needs, also I write mode tcp, you can change it to http if you need http load balance

frontend frontend_chat 127.0.0.1:8080
    mode tcp
    balance roundrobin
    acl max_conn_reached fe_conn gt 20
    default_backend be_chat1
    use_backend be_chat1_and_chat2 if max_conn_reached

backend be_chat1
    mode tcp
    balance roundrobin
    server chat1 127.0.0.1:9001 check maxconn 10

backend be_chat1_and_chat2
    mode tcp
    balance roundrobin
    server chat1 127.0.0.1:9001 check maxconn 10
    server chat2 127.0.0.1:9002 check maxconn 10
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.