virtual server connection rate limit with tables
That's a great question. It is - though if you're using a current version, you might prefer the built-in rate-limiting. There's a setting for it on virtual servers.
Here's why it works: Tcl says [clock clicks] should be the highest resolution counter available, so every call (for a given TMM - more on that in a second) will return a unique value. I checked using this iRule:
when RULE_INIT {
log local0. [clock clicks]
log local0. [clock clicks]
}
and got these log messages, which look like microseconds:
Mar 28 08:28:16 localhost info tmm[18961]: Rule /Common/log_clicks : 1553786896032566
Mar 28 08:28:16 localhost info tmm[18961]: Rule /Common/log_clicks : 1553786896032743
Using TMM::cmp_group and TMM::cmp_unit avoids collisions between TMMs, even if two call clock at the same microsecond (I borrowed this idea from twitter, it's similar to their Snowflake CRDT).
Be aware this can create a lot of inter-TMM traffic on high-traffic systems - not normally an issue, but each subtable lives on a single TMM and so if you have a large system with a busy virtual server this can put a lot of load on one TMM. I recommend testing either way.