Forum Discussion

Deon's avatar
Deon
Icon for Nimbostratus rankNimbostratus
Jun 30, 2008

When to iRule and when not to?

The task at hand today is a very simple redirect to an app login page when a user types only the host name and the uri is "/". The following code works. This is obviously super simple.

 

 

 
 when HTTP_REQUEST { 
   if { [HTTP::uri] equals "/" } { 
     HTTP::redirect "http://[HTTP::host]/MyApp/en/US/MyApp/Login.jsp" 
   } 
 } 
 

 

 

There are no other iRules for this virtual server.

 

 

I see two ways to implement the redirect and am looking for feedback on which way is the the best route given that there are no other iRules for this VS.

 

 

1) Use above iRule. Looks at each and every request and redirects if uri is "/".

 

2) Create & package a simple rootredirect.war file with one (default) html page that does the redirect. Deploy this simple war on tomcat server.

 

 

Implementing the redirect with an iRule obviously creates overhead on the BigIP as each and every HTTP_REQUEST fires the (albeit small & simple) iRule to execute. The rootredirect.war approach does not incur such overhead but does create one addl war that needs to be deployed on the tomcat server.

 

 

So, given there are no other requirements that would require to look at each HTTP_REQUEST, would it be more desirable to implement the redirect at the tomcat server and save the processing cycles on the BigIP?

 

 

Am I splitting hairs and worrying about something I should not necessarily worry about?

 

 

Looking for the opinion of others here.

 

 

Thanks

 

-Deon

3 Replies

  • The overhead for parsing the HTTP headers and checking the URI is very minimal. However, if you have the ability to handle the redirect at the web server, it would be more efficient from the LTM perspective.

     

     

    You could do some sample load testing with and without the rule to get an idea of the latency added. You could also compare the TMM CPU usage with and without the rule. I would guess the differences would be low enough that it would be difficult to measure.

     

     

    Aaron
  • Deon's avatar
    Deon
    Icon for Nimbostratus rankNimbostratus
    Thanks for the info. Yesterday I did an informal test by adding this rule with a bogus match string (so it would never redirect) to an existing virtual server with a LOT of traffic. I could not see any difference at all in response times nor in BigIP load.

     

     

    Thanks for your help and input!

     

     

    -Deon
  • Hi Deon,

     

     

    Thanks for the follow up. Your results are expected, but it's good to see confirmation.

     

     

    Aaron