Forum Discussion
irule performance question
Is it better to have 10 different irules applied to the same virtual server that do similar thing or is it better to combine in one script? Or either way doesn't matter? Eg pseudo scripts with 26 irules:::
irule A: if (src ip 10.1.1.1) then pool A
irule B: if (src ip 10.1.1.2) then pool B
..
irule Z: if (src ip 10.1.1.26) then pool Z
Or is it better to do:
just 1 irule:: if (src ip 10.1.1.1) then pool A else if src ip 10.1.1.2) then pool B... else pool Z (or do a case statement for this in a single irule)
- nitassEmployeeif we code the irule something like this, will a number of irule reduce?
[root@ve1023:Active] config b virtual bar list virtual bar { snat automap pool foo destination 172.28.65.152:http ip protocol tcp rules myrule } [root@ve1023:Active] config b rule myrule list rule myrule { when CLIENT_ACCEPTED { if {[class match -- [IP::client_addr] equals xyz]} { log local0. "client is [IP::client_addr]:[TCP::client_port], action is [class match -value [IP::client_addr] equals xyz]" } } } [root@ve1023:Active] config b class xyz list class xyz { { network 172.28.19.0/24 { "action2" } host 192.168.204.7 { "action1" } } } [root@ve1023:Active] config tail -f /var/log/ltm Nov 15 08:48:30 local/tmm info tmm[4766]: Rule myrule : client is 192.168.204.7:54379, action is action1 Nov 15 08:48:38 local/tmm info tmm[4766]: Rule myrule : client is 172.28.19.253:59039, action is action2
- Michael_YatesNimbostratusHi Romel,
- HamishCirrocumulusAlso, when the iRUles are combined, the namespace is shared. So a variable called $MyVar in iRule1 will be the SAME variable in iRule2...
- Michael_YatesNimbostratusExcellent Point Hamish.
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com