Forum Discussion
Luca_55898
Nimbostratus
Aug 03, 2011Possible performance issue with iRule?
Hi,
I have this iRule configured on a fairly standard HTTP VIP.
"when HTTP_REQUEST {
switch -glob [HTTP::uri] {
"/ee/employer*" { pool Pool_ee_employer_83 }
"/ee/search*" { pool Pool_ee_search_84 }
"/pack*" { pool Pool_pack_85 }
}
}"
The VIP does not have any persistance configured.
It has the default HTTP profile assigned
No default pool is selected either.
The iRule works fine, however people have been complaining that the images on the pages take a while to load and sometimes do not load at all.
When testing if i continually press refresh on my browser the images will load, but also the page changes its layout. For example - it goes from left aligned to centre aligned. Sometimes borders are displayed, sometimes they are not.
Could this be an issue with the iRule or the F5?
12 Replies
- Kevin_Davies_40
Nacreous
1. Since you have no default for the switch you have no way to tell if some URI's are failing to match. You should add a default which logs the unmatched URI as they will fail to get a response if no pool is selected...switch -glob [HTTP::uri] { "/ee/employer*" { pool Pool_ee_employer_83 } "/ee/search*" { pool Pool_ee_search_84 } "/pack*" { pool Pool_pack_85 } default { log "Unmatched URI [HTTP::uri]" } }
2. If you are switching pools then you need to make sure that the CSS page from one pool will work on page elements from different servers. Often CSS is designed to match the content coming from the same web server or pool of identical web servers.
3. You should be using HTTP classes instead of an iRule for this. Ensure that you add a default catch-all class at the end.
Start with the logging as that may provide some clues. - Luca_55898
Nimbostratus
Thanks,
Will that default rule log to the local traffic logging section?
I'll investigate the http class as well, i though an irule was the only way to redirect based on URI - Kevin_Davies_40
Nacreous
Yes it will log to /var/log/ltm - Luca_55898
Nimbostratus
Yep so i'm seeing lots of Unmatched URI logs now:
: Unmatched URI /ee/images/ConfirmEmployer.bmp
: Unmatched URI /ee/scripts/search-franchise.js
: Unmatched URI /ee/scripts/autosuggest.js
I think setting a default pool may sort this out. Or should i look into HTTP Classes? - Kevin_Davies_40
Nacreous
The unmatched entries pretty much reveal the problem. My suggestion is to use HTTP classes because they are designed for this kind of job. You will need one for each pool and a default catch-all at the end. Mind you having a default pool will have the added benefit as showing the VIP as being up instead of unknown. - boomchke_11156
Nimbostratus
Where is the default log location set? Can that be modified? Thats a great tip on using the 'deafult' command. - Michael_Yates
Nimbostratus
By default log files go to /var/log/ltm
You can create a Custom Log if you like:
http://devcentral.f5.com/Community/GroupDetails/tabid/1082223/asg/44/aft/1172420/showtab/groupforums/Default.aspx - Luca_55898
Nimbostratus
So i configured a HTTP class and got all this working, so thanks for the assistance.
I configured a class for every pool and matched on the URI:
Also matched on the location of all the images and scripts, which were the unmatched errors i was getting before.
SO my URI path list for each pool is something like
Pool 1
*/employer/* <-- URI for relevent pool
*/ee/* <-- location of the images and scripts
Pool2
*/search/* <-- URI for relevent pool
*/ee/* <-- location of the images and scripts
Pool2
*/pack* <-- URI for relevent pool
*/ee/* <-- location of the images and scripts
One question though - what is the 'F5 reccomended' way to do simple redirects like this?
HTTP Class or iRules? - Kevin_Davies_40
Nacreous
The recommended way is to always use built-in functionality unless specifically told otherwise. HTTP classes were added to the F5 to solve these kinds of problems without the need of iRules. Please do not forget the default catch all http class at the end to send traffic back to the default pool or you may get unexpected results. - Luca_55898
Nimbostratus
I just added a default pool to the VIP.
Will that accomplish the same thing?
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