I'm currently in the process of setting up HAProxy 18.104.22.168 for a larger webserver cluster. Each of the webservers is able to handle every request on its own as the service is stateless. Balance roundrobin is thus preferred.
However, due to heavy caching performed on each server, I want to define some kind of "soft affinity" based on a get-parameter to optimize the cache utilization on each server. Based on that parameter, I can seperate servers into 3 groups of different sizes (later more) which each should handle one parameter value. I think, "balance url_param <param>" does it here.
To prevent overloading, I want to restrict the number of concurrent connections each server should receive. I found "maxconn", "minconn" and "timeout queue" on server level (or server group level) to be promising. Unfortunately, it does not seem to fully cover my requirements, as I want a request to be transparently redispached to another server in the same group if an individual servers queue fills up or to a server in another group if the groups queue fills up.
In short: I want to dispatch a request to an arbitrary server of its group (based on the get parameter) if this server is able to fullfill the request now (or in the very near future). As a fallback solution, I want a roundrobin approach to dispatch additional requests to an arbitrary server. Only as the very last ressort I want requests to fail (preferable only, if _all_ servers are saturated).
Part of that seems to be achievable by using "option redispatch". But I'm not sure if it completely covers the requirements. My first approach is added below. But I think the redispatch in case of a filled backend queue will not work correctly. Maybe you could nudge me in the right direction.
timeout queue 200
frontend proxy 22.214.171.124:80
balance url_param my_param
use_backend group1 if url_sub my_param=g1 use_backend group2 if url_sub my_param=g2 use_backend group3 if url_sub my_param=g3default_backend all_servers
server app1 192.168.1.11:80 maxconn 50 minconn 20 server app2 192.168.1.12:80 maxconn 50 minconn 20
server app3 192.168.1.13:80 maxconn 50 minconn 20 server app4 192.168.1.14:80 maxconn 50 minconn 20 server app5 192.168.1.15:80 maxconn 50 minconn 20
server app6 192.168.1.16:80 maxconn 50 minconn 20
server app1 192.168.1.11:80 maxconn 50 minconn 20 server app2 192.168.1.12:80 maxconn 50 minconn 20 server app3 192.168.1.13:80 maxconn 50 minconn 20 server app4 192.168.1.14:80 maxconn 50 minconn 20 server app5 192.168.1.15:80 maxconn 50 minconn 20 server app6 192.168.1.16:80 maxconn 50 minconn 20
Thanks for your advice!
Regards, Holger Received on 2008/08/05 16:44
This archive was generated by hypermail 2.2.0 : 2008/08/05 17:00 CEST