On Tue, Nov 24, 2009 at 06:39:22PM +0000, Malcolm Turnbull wrote:
> Probably simple question? Can backup be used when maxcons reached?
>
> Say you have 3 servers with cookie persistence and MAXCONS 10,
> so when they hit 10 connections the connections are queued...
>
> Can you say that rather than going to queue, the connections are sent
> to the backup server "saying sorry we are busy".
you cannot do that with the backup server because a backup server will only be inserted into the farm when all other ones are dead. However, you can decide to forward connections to another backend, and you could even do that based on the server cookie, so that you only redirect new users and not the ones already having a session. A good practice also consists in doing that only after the average queue size reaches a certain level. For instance :
frontend
acl backend_full avg_queue(bck) gt 10 acl known_user hdr_sub(Cookie) SID= use_backend sorry if backend_full !known_user
backend bck
cookie SID
server xxx1 cookie xxx1 maxconn 10
backend sorry
server xxx
The avg_queue(bck) counts the total number of queued connections and divides it by the number of alive servers. That way, it considers the average number of queued requests per server, allowing you to set a level above which you think the service will get degraded.
You can even change that slightly so that haproxy returns the error page itself :
frontend
acl backend_full avg_queue(bck) gt 10 acl known_user hdr_sub(Cookie) SID= use_backend bck if !backend_full || known_user errorfile 503 sorry-we-re-busy.http
backend bck
cookie SID
server xxx1 cookie xxx1 maxconn 10
Regards,
Willy
Received on 2009/11/25 06:33
This archive was generated by hypermail 2.2.0 : 2009/11/25 06:45 CET