Forum Discussion
Vincent_Power_9
Nimbostratus
Jul 03, 2007Performance Question in Large iRule
I run into this situation a lot, where an iRule will look like this (our business users want everything behind one hostname/port).
Historically we've been building them like this since it is quick and easy to maintain.
Pool One
if { [HTTP::uri] starts_with "/abc/" } {
pool one
} else if { [HTTP::uri] starts_with "/bcd/" } {
pool one
} else if { [HTTP::uri] starts_with "/cde/" } {
pool one
} else if { [HTTP::uri] starts_with "/def/" } {
pool one
} else if { [HTTP::uri] starts_with "/efg/" } {
pool one
} else if { [HTTP::uri] starts_with "/hij/" } {
pool one
} else if { [HTTP::uri] starts_with "/ijk/" } {
pool one
} else if { [HTTP::uri] starts_with "/jkl/" } {
pool one
}
Pool Two
if { [HTTP::uri] starts_with "/klm/" } {
pool two
} else if { [HTTP::uri] starts_with "/lmn/" } {
pool two
} else if { [HTTP::uri] starts_with "/mno/" } {
pool two
} else if { [HTTP::uri] starts_with "/nop/" } {
pool two
}
Pool Three
if { [HTTP::uri] starts_with "/opq/" } {
pool three
} else if { [HTTP::uri] starts_with "/pqr/" } {
pool three
} else if { [HTTP::uri] starts_with "/qrs/" } {
pool three
} else if { [HTTP::uri] starts_with "/rst/" } {
pool three
}What would a better way be to make iRules like this more efficient? I don't think "switch -glob" meets my specific need.
3 Replies
No RepliesBe the first to reply