Forum Discussion
VictorC
Apr 05, 2012Nimbostratus
Performance question on 2 iRules
Hi all,
I have 2 different iRules I am using and they both do the same thing so that I can conserve IP addresses. I was wondering if there was any performance hit on a LTM running 10.2 if I used one over the other. Here are simple samples:
rule myrule1 {
when HTTP_REQUEST {
switch [string tolower [HTTP::host]] {
"url1.mycompany.com" {
pool mypool1
}
"url2.mycompany.com" {
pool mypool2
}
"myurl3.mycompany.com" {
pool mypool3
}
default {
discard
}
}
}
}
rule myrule2 {
when HTTP_REQUEST {
switch -glob [HTTP::host] {
url1* { pool mypool1 }
url2* { pool mypool2 }
url3* { pool mypoo13 }
default { pool mypool1 } or discard it
}
}
}
Note that on both these iRules I'm expecting to match up to 10 URLs/pools and the number of clients accessing them could be a thousand. I would also be implementing a few dozen of these iRules. I would like to know which iRule performs better and has the least cpu/memory utilization on the LTM.
Any advice is great.
Thanks
- nitassEmployeei think comparing literal string (the 1st one) may be more effective.
- hooleylistCirrostratusI thought the exact match would be more efficient also until I tried a test with tlcsh.
- dlg_23340CirrusThere are plenty of examples from F5 about switch being faster than if/else. Here are a couple:
- VictorCNimbostratusThank you all for the great tips.
- hooleylistCirrostratusHi Victor,
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects