Re: patch for new acl - 'nbsrvconnslots' (number of maxconn, or queue slots available)

From: Willy Tarreau <w#1wt.eu>
Date: Tue, 2 Sep 2008 22:38:22 +0200


Hi Jeffrey,

On Sun, Aug 24, 2008 at 05:37:21PM +0800, Jeffrey 'jf' Lim wrote:
> I'm in the process of setting up one haproxy instance now, and I find
> the following acl option useful. I'm not too sure why this option has
> not been available before, but I find this useful for my own usage, so
> I'm submitting this patch in the hope that it will be useful as well.

That's a very nice initiative.

> The basic idea is to be able to measure the available connection slots
> still available (connection, + queue) - anything beyond that can be
> redirected to a different backend. 'nbsrvconnslots' = number of
> available server connection slots, + number of available server queue
> slots.

I like the idea, it clearly makes sense...

> In the case where we encounter srv maxconn = 0, or srv maxqueue
> = 0 (in which case we dont need to care about nbsrvconnslots) the
> value you get is -999 (let me know if you think another value is
> better).

...but I hate such magic values :-) Generally we use zero for unlimited (eg: maxconn) but when that's not possible, we set to -1 but check for <0.

> Note also that this code does not take care of dynamic
> connections at this point in time.
>
> The reason why I'm using this new acl (as opposed to 'nbsrv') is that
> 'nbsrv' only measures servers that are actually *down*. Whereas this
> other acl is more fine-grained, and looks into the number of conn
> slots available as well.
>
> Comments are welcome.

I would like the name to get shorter (eg: "connslots", "freeconns" or "connleft", you get the idea). I will ask you to add an entry for your keyword in the configuration manual with a few lines of a use example (where/when this would be useful), and I have no problem to merge it.

Thanks!
Willy Received on 2008/09/02 22:38

This archive was generated by hypermail 2.2.0 : 2008/09/02 22:45 CEST