17-Feb-2020 03:04
I had used the static keyword in my iRule some days ago in RULE_INIT event since I wanted certain variables to be globally declared as follows :
when RULE_INIT {
set static::windowSec 60
set static::queryCount 600
}
This use of static keyword caused a massive load on only one of the cores of F5 due to which I had to detach the iRule. Being a newbie I was unable to understand the root cause of this issue. Also I would like to know the following :
17-Feb-2020 18:25
Based on this I think you're setting it correctly. Maybe you're using it in such a way in the irule that makes it "demote CMP".
Check this article out which explains what that means
https://devcentral.f5.com/s/articles/the101-irules-101-variables
Are you referencing it as $static::windowSec
21-Feb-2020 01:57
Yes I am referencing it as $static::windowSec. Will this trigger a CMP demonition?
17-Feb-2020 18:49
> This use of static keyword caused a massive load on only one of the cores of F5 due to which I had to detach the iRule. Being a newbie I was unable to understand the root cause of this issue.
This would be due to CMP demotion - If something in the virtual server config or the irule means that there will be issues with multithreading the traffic across multiple tmms (the default), then the virtual will be demoted from CMP and all the traffic will be processed on one core. This can be extremely detrimental to performance.
Just the use of the static:: keyword should not trigger CMP demotion - in fact, it is intended to be a CMP-safe way to share non-changing variables across tmm instances in a safe manner.
There may have been something else within the irule that caused CMP demotion for your irule.
> Also I would like to know the following :
The static:: namespace is shared across all irules - so every irule will see all the static variables.
If you try to change a static:: variable within an irule, it will only change on the particular tmm, producing inconsistent results.