Forum Discussion
Dayton_Gray_103
Nimbostratus
Aug 21, 2006Help with optimization of this iRule
I have been asked by F5 to post this iRule to see if there are any ways to optimize it as to lower the total CPU usage on the machine. This rule seems pretty straight-forward, but I'm open to suggesti...
unRuleY_95363
Aug 21, 2006Historic F5 Account
Depending on whether or not you actually want case insensitive matches, the switch statement is probably your best bet. Also, avoiding any variables will also help get the absolute best performance from the rule.
Here are two examples, the first one with case sensitivity and the second one without:
when HTTP_REQUEST {
pool demo_192.168.1.195.80
if { [HTTP::host] eq "www.demodomain.com" } {
switch -glob [HTTP::header User-Agent] {
*[sS]lurp* -
*msnbot* -
*[Ff][Aa][Ss][Tt]-* -
*[Tt]eoma* -
*[Gg]ooglebot* {
pool bots.80 Override to new pool
}
default {
pool demo_192.168.1.195.80
}
}
} else {
pool demo_192.168.1.195.80
}
}when HTTP_REQUEST {
pool demo_192.168.1.195.80
if { [HTTP::host] eq "www.demodomain.com" } {
switch -glob -nocase [HTTP::header User-Agent] {
*slurp* -
*msnbot* -
*fast-* -
*teoma* -
*googlebot* {
pool bots.80 Override to new pool
}
default {
pool demo_192.168.1.195.80
}
}
} else {
pool demo_192.168.1.195.80
}
}Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
