Forum Discussion
Sully_103006
Apr 08, 2011Historic F5 Account
Is there anyway to make this Siebel iRule more efficient?
when CLIENT_ACCEPTED {
TCP::collect 1 }
when CLIENT_DATA {
if { [findstr [TCP::payload] "/siebel" 0 " "] == "/siebel/finsobjmgr_enu" } {
log local0. "Using pool company.org_2321_pool"
pool company.org_2321_pool
}
elseif { [findstr [TCP::payload] "/siebel" 0 " "] == "/siebel/smobjmgr_enu" } {
log local0. "Using pool company.org_2321_pool"
pool company.org_2321_pool
}
elseif { [findstr [TCP::payload] "/siebel" 0 " "] == "/siebel/eaiobjmgr_enu" } {
log local0. "Using pool company.org_2321_pool"
pool company.org_2321_pool
}
elseif { [findstr [TCP::payload] "/siebel" 0 " "] == "/siebel/finsobjmgr_enu/rr" } {
log local0. "Using pool company.org_2321_pool"
pool company.org_2321_pool
}
elseif { [findstr [TCP::payload] "/siebel" 0 " "] == "/siebel/smobjmgr_enu/rr" } {
log local0. "Using pool company.org_2321_pool"
pool company.org_2321_pool
}
elseif { [findstr [TCP::payload] "/siebel" 0 " "] == "/siebel/eaiobjmgr_enu/rr" } {
log local0. "Using pool company.org_2321_pool"
pool company.org_2321_pool
}
elseif { [findstr [TCP::payload] "/siebel" 0 " "] contains "/!5." } {
log local0. "Using pool APP01_2321_pool"
pool APP01_2321_pool
}
elseif { [findstr [TCP::payload] "/siebel" 0 " "] contains "/!7." } {
log local0. "Using pool APP02_2321_pooll"
pool APP02_2321_pool
}
elseif { [findstr [TCP::payload] "/siebel" 0 " "] contains "/!9." } {
log local0. "Using pool APP03_2321_pool"
pool APP03_2321_pool
}
elseif { [findstr [TCP::payload] "/siebel" 0 " "] contains "/!b." } {
log local0. "Using pool APP04_2321_pool"
pool APP04_2321_pool
}
elseif { [findstr [TCP::payload] "/siebel" 0 " "] contains "/!d." } {
log local0. "Using pool APP05_2321_pool"
pool APP05_2321_pool
}
else {
log local0. "Rejected request for [findstr [TCP::payload] "/siebel" 0 " "]"
discard }
}
19 Replies
Sort By
- Not sure if the APP pool matching is good enough with "glob" matching (you may need "regexp" matching depending on whether the string does or does not start with the data), but this might work:
when CLIENT_ACCEPTED { TCP::collect 1 } when CLIENT_DATA { switch -glob [findstr [TCP::payload] "/siebel" 0 " "] { "/siebel/finsobjmgr_enu" - "/siebel/smobjmgr_enu" - "/siebel/eaiobjmgr_enu" - "/siebel/finsobjmgr_enu/rr" - "/siebel/smobjmgr_enu/rr" - "/siebel/eaiobjmgr_enu/rr" { pool company.org_2321_pool } "/!5.*" { pool APP01_2321_pool } "/!7.*" { pool APP02_2321_pool } "/!9.*" { pool APP03_2321_pool } "/!b.*" { pool APP04_2321_pool } "/!d.*" { pool APP05_2321_pool } default { log local0. "Rejected request for [findstr [TCP::payload] "/siebel" 0 " "]" discard } } }
- Aaah switch -glob is what I'm missing. Thanx Joel!
- As a side benefit, switch -glob is many times faster than if/else chains. So cleaner, more functional, AND faster. It's a trifecta. ;)
- Oof, just re-read the original iRule. switch is going to be many, many orders of magnitude faster for the deeper matches because in the original example you were running the findstr with contains on every single if. This should be a massive performance improvement.
- Rock on! This is what I'm talkin about. Many thanks to all.
- Hmmm...it looks like switch -glob kinda works tho when using this iRule I never get traffic to the APP01-APP05 pools. I think the " * " in "/!5.*" maybe causing the mismatch. The original iRule used "/!5." and matched well.
- Hmmm...it looks like switch -glob kinda works tho whne using this iRule I never get traffic to the APP01-APP05 pools. I think the " * " in "/!5.*" maybe causing the mismatch. The original iRule used "/!5." and matched well.
- * will match zero or more of any character for string patterns:
- When it tries and fails to do a switch match, Sully, what does it log in the LTM logs? Can you post some of those? I would be willing to bet that it is not matching some sort of content just prior to the /! string... The original iRule used "contains" there, which probably means our match needs to be modified to account for that. Glad to help...
- The string usually looks something like:
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