Forum Discussion
Jaymz_mynes_653
Nimbostratus
Nov 30, 2006Efficient iRule writing
I am getting ready to create some iRules and because the rules are going to cover a lot of area I am concerned about the efficiency in which they are written. Here is the scenario, I have just put together an IIS 6.0 webfarm that uses the BigIP v9 LTM as its load balancer. The previous implementation of our website relied heavily on access DBs (yuck, I know), some of those are gone, but some are still around, so what I have to do is create iRules that redirect (based on uri) to the first node in the farm. The first node houses those access DBs… I was happy to find out how easy it was, but then I started to worry about what the iRule was starting to look like when I was writing it.
Basically I have around 80 redirects I have to make, so do I…
-Create an iRule for each redirect (I hope not)?
-Put all of the redirects in 1 iRule using a more efficient method than "or"?
-Put all of the redirects in 1 iRule and use the Logical Operator “or” as many times as it takes? (Like below, but with many more redirects)
when HTTP_REQUEST {
if { ([HTTP::uri] contains "/Microsoft") or ([HTTP::uri] contains "/Cisco") or ([HTTP::uri] contains "/Photogallery") } {
node 10.102.180.69 80
}
}
- hoolio
Cirrostratus
If you have 80 URI's to match against, it would probably be easiest to administer if you defined them in a class (data group in the GUI) and used the matchclass function to perform the test.class uris { "/uri1/" "/uri2" }
when HTTP_REQUEST { if { [string tolower [matchclass [HTTP::uri]] contains $::uris] }{ node 10.102.180.69 80 } }
- Jaymz_mynes_653
Nimbostratus
I am trying to edit the bigip.conf file to add this data group, but when i do, the changes do not show up in the GUI... Am I doing something wrong? - After editing the config file you'll have to load it into memory with the "b load" command. If you loaded it via the command line and it's still not showing up in the GUI, odds are you got something wrong with the format of the class definition.
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