I looked at that first,
unfortunately we have two separate classes of servers that have
essentially a different maximum amount of incoming they can handle
before they miss their window due to becoming too saturated with
requests.
I may look into setting it from the stats port, but I don't think that
will work for ACLs and I'll have to wait for a maxconnrate config option
for each server.
Let me know if this doc is too vague or confusing, been a long day.
doc/configuration.txt:
@@ -8009,6 +8009,20 @@
acl being_scanned be_sess_rate gt 100
redirect location /denied.html if being_scanned
+srv_sess_rate(<backend>/<server>) <integer>
+ Returns true when the sessions creation rate on the server matches
the
+ specified values or ranges, in number of new sessions per second.
This is
+ used to switch to an alternate backend when an expensive or fragile
one
+ reaches too high a session rate, or to limit abuse of service (eg.
prevent
+ latent requests from overloading servers).
+
+ Example :
+ # Redirect to a separate back
+ acl srv1_full srv_sess_rate(be1/srv1) gt 50
+ acl srv2_full srv_sess_rate(be1/srv2) gt 50
+ use_backend be2 if srv1_full or srv2_full
+
+
connslots <integer>
connslots(<backend>) <integer>
The basic idea here is to be able to measure the number of connection
"slots"
Cheers, and thanks Willy.
Tait
Hi Tait,
Your
patch looks totally right to me. I'm not sure it will be of much use
in other environments than yours, but it doesn't cost anything to merge
it (at least it will save you from maintaining the patch). Please could
you send a short doc update with it, and I'll happily apply it.
Also,
you said you have to use a number of these rules. Wouldn't it be easier
in your situation to rely on an average rate per server ? You have
the backend's session rate, you have the number of active servers, so
with a divide, you have the average per-server rate. Look at the avg_queue
ACL to see how that can be done. I'm sure it will be even more
useful for you !
Regards, Willy
Hey List,
Considering there is no option yet for maxconnrate for servers (I
heard
this is on the roadmap), I wrote an ACL to check a backend server
session rate which we use to send to an "overflow" backend to prevent
latency responses to our clients (very sensitive latency requirements).
Unfortunately since it on a server by server basis, I have to set
quite
a few of them in our environment.
I'm not much of a programmer, so if this is completely wrong let me
know
however I can confirm this works as expected and does limit it properly
when called.
src/backend.c
@@ -1612,6 +1587,20 @@
return 1;
}
+static int
+acl_fetch_srv_sess_rate(struct proxy *px, struct session *l4, void
*l7,
unsigned int opt,
+ const struct arg *args, struct sample *smp)
+{
+ smp->flags = SMP_F_VOL_TEST;
+ smp->type = SMP_T_UINT;
+ smp->data.uint =
read_freq_ctr(&args->data.srv->sess_per_sec);
+ return 1;
+}
+
/* Note: must not be declared <const> as its list will be
overwritten.
* Please take care of keeping this list alphabetically sorted.
*/
@@ -1620,11 +1609,11 @@
{ "be_conn", acl_parse_int, acl_fetch_be_conn,
acl_match_int, ACL_USE_NOTHING, ARG1(1,BE) },
{ "be_id", acl_parse_int, acl_fetch_be_id,
acl_match_int, ACL_USE_NOTHING, 0 },
{ "be_sess_rate", acl_parse_int, acl_fetch_be_sess_rate,
acl_match_int, ACL_USE_NOTHING, ARG1(1,BE) },
{ "connslots", acl_parse_int, acl_fetch_connslots,
acl_match_int, ACL_USE_NOTHING, ARG1(1,BE) },
{ "nbsrv", acl_parse_int, acl_fetch_nbsrv,
acl_match_int, ACL_USE_NOTHING, ARG1(1,BE) },
{ "queue", acl_parse_int, acl_fetch_queue_size,
acl_match_int, ACL_USE_NOTHING, ARG1(1,BE) },
{ "srv_conn", acl_parse_int, acl_fetch_srv_conn,
acl_match_int, ACL_USE_NOTHING, ARG1(1,SRV) },
+ { "srv_sess_rate", acl_parse_int,
acl_fetch_srv_sess_rate,
acl_match_int, ACL_USE_NOTHING, ARG1(1,SRV) },
{ "srv_id", acl_parse_int, acl_fetch_srv_id,
acl_match_int, ACL_USE_RTR_INTERNAL, 0 },
{ "srv_is_up", acl_parse_nothing, acl_fetch_srv_is_up,
acl_match_nothing, ACL_USE_NOTHING, ARG1(1,SRV) },
{ NULL, NULL, NULL, NULL },
Let me know your thoughts.
- Tait
|