Quantcast
Channel: Serverphorums.com - HAProxy
Viewing all articles
Browse latest Browse all 5112

Using operators in ACLs (no replies)

$
0
0
Hello,

I want to define ACL which will evaluate to true if a current number of connections to a particular backend is greater than a number of usable servers in that backend multiplied on some constant:

be_conn(BACK) > nbsrv(BACK) * N

So far I came up with the following solution:

frontend FRONT
mode http # can be either http or tcp here
tcp-request content set-var(sess.nb) nbsrv(BACK) # I use tcp-request here (not http-request) so it works for both http and tcp mode backends
acl my_acl be_conn(BACK),div(sess.nb) gt 10 # "N" in 10 here


So I must use set-var here because div() accepts either a number or a variable.

Is this a good sulution for my problem or it can be done better?

Thanks!

Viewing all articles
Browse latest Browse all 5112

Trending Articles