On Fri, Feb 20, 2009 at 02:23:37PM -0800, Karl Pietri wrote:
> Hello everyone,
> I am using haproxy with ruby on rails backend servers and am trying to
> setup a system that will have a few mongrels dedicated to priority traffic
> and spill over to the main pool if those are busy.
> i've attached a diagram of what i'm trying to accomplish.
> Eseentially i have 2 pools. all the servers in each pool have maxconn 1
> (because mongrel sucks). a magorit of servers are in pool A and serve my
> normal traffic. I want to dedicate a few servers to pool B so that they are
> usually unloaded for some priority traffic. For the trafic going to that
> pool i want it to go to the few servers there unless they are all busy and
> in that case send the traffic to pool A for processing along with the rest
> of the stuff.
> I thought backup would do this but backup servers are only given traffic if
> all servers in the pool are down. not if all servers are busy.
For this you could use an ACL relying on "connslots" or "dst_conn". "connslots" counts the remaining number of connections that can be accepted, server queue included. "dst_conn" counts the number of connections on the frontend.
Basically, it would look like this :
... acl nearly_full connslots(back1) -lt 10 use_backend back2 if nearly_full default_backend back1 backend back1 ... server srv1 127.0.0.1:8001 maxconn 1 maxqueue 2 server srv1 127.0.0.1:8002 maxconn 1 maxqueue 2 server srv1 127.0.0.1:8003 maxconn 1 maxqueue 2 server srv1 127.0.0.1:8004 maxconn 1 maxqueue 2 server srv1 127.0.0.1:8005 maxconn 1 maxqueue 2 backend back2 ... server srv1 127.0.0.1:8101 maxconn 1 maxqueue 2 server srv1 127.0.0.1:8102 maxconn 1 maxqueue 2 server srv1 127.0.0.1:8103 maxconn 1 maxqueue 2 server srv1 127.0.0.1:8104 maxconn 1 maxqueue 2 server srv1 127.0.0.1:8105 maxconn 1 maxqueue 2
Etc... I think you get the idea. Please check configuration.txt for more details about ACL usage if needed.
Willy Received on 2009/02/22 16:42
This archive was generated by hypermail 2.2.0 : 2009/02/22 17:45 CET