HAProxy General Purpose Counters and Table Tables

I am trying to use HAProxy to limit speed. I need to track multiple endpoints and limit them individually. So far I have used general purpose counters. However, there are only 3, from sc0 to sc2.

The documentation mentions that all operations on these counters accept an optional table parameter, but this is unclear, then if I can track different things in different tables, but using the same counters.

In other words: is the limit of 3 general-purpose counters global or a sticky table?

If, after the correct definition of the table and the instructions of the track, I do

sc1_inc_gpc0(table1)

(and, in different conditions)

sc1_inc_gpc0(table2)

And then there are 2 acl rules like acl X sc1_get_gpc0(table1) gt 1 acl Y sc1_get_gpc0(table2) gt 1

Will the two aclwork autonomously, otherwise they will process the same counter?

Thanks for the help! (If you are interested: for a number of reasons, at the moment I could not use a solution other than HAProxy to limit the speed)

+4
source share
1 answer

The answering machine responded to the source code and testing.

  • Yes, you can use the same counter in different tables
  • In addition, you can increase the number of available counters during assembly. The default value is 3, but it can be set to 10. Then you can use the general version of functions of the type sc_gpc0_rate(<ctr>[,<table>]), passing the index of the new counter as the first argument.
+5
source

Source: https://habr.com/ru/post/1671679/


All Articles