Hi Folks,
I'm looking for a way to count the number of in-flight operations per
user (extracted from the URL path) and store that value in a variable.
My goal is to track and enforce a per-user concurrency limit using
HAProxy's stick tables and GPC.
My approach is to use a GPC counter, incrementing it on request and
decrementing it when the response is sent.
Draft Configuration;
```
frontend http-in
bind *:80
stick-table type string size 1m expire 10m store gpc0
http-request set-var(txn.user) path,regsub(^/([^/]+)/.*$,\1)
http-request track-sc0 var(txn.user)
# Increase in-flight counter
http-request set-var(txn.gpc0) sc_inc_gpc0()
# Limit concurrent requests per user to 5
acl user_over_limit sc_get_gpc0() gt 5
http-request deny if user_over_limit
# Decrease in-flight counter when response is sent
http-response set-var(txn.gpc0) sc_dec_gpc0()
...
```
However, sc_dec_gpc0() does not seem to be implemented yet. Do you
think such a function is needed, or is there another approach I could
take to track in-flight operations per user effectively?
Any insights or suggestions would be greatly appreciated.
Thanks,
Ansgar