Forum Discussion

tonio_tian_1127's avatar
tonio_tian_1127
Icon for Nimbostratus rankNimbostratus
May 13, 2005

how to using iRules to optimize persist???

There are five pools in my rule, When http request that switched on the URI to select the pool.When select the pool exdous_http_pool. It’s has cookie persistence requirements.If selece other pool,It’s not has persistence requirements,

So I write the rule:

 
  when HTTP_REQUEST {  
  if {[HTTP::host] equals "china.ali.com" }  
     {  
      if {[HTTP::uri] equals "/"}  
         {persist none  
          pool old_statics}  
      elseif {[HTTP::uri] equals "/index.html"}  
         {persist none  
          pool old_statics}  
      elseif {[HTTP::uri] contains "sell"}  
         {persist none  
          pool statics}  
      elseif {[HTTP::uri] contains "buy"}  
         {persist none  
          pool  statics}  
      elseif {[HTTP::uri]  contains "/athena/turbine"}  
         {persist none  
          pool athena_ali}  
      elseif {[HTTP::uri]  contains "mysite"}  
         {persist none  
          pool athena_ali}  
      elseif {[HTTP::uri]  contains "img"}  
         {persist none  
          pool img_http_pool}  
      elseif {[HTTP::uri]  contains "trust"}  
         {persist none  
          pool statics}  
      else {persist cookie insert mycookies  
            pool exdous_http_pool}  
     }  
  else {persist cookie insert mycookies  
        pool exdous_http_pool}  
  }  
 

As a result, soever select anypool It always do persistence .what’s error in my rule??

3 Replies

  • unRuleY_95363's avatar
    unRuleY_95363
    Historic F5 Account
    Ok, I can only see one potential issue. Tcl is very picky about where the opening brace '{' is after an if statement. The Tcl syntax requires it to be on the same line as the if. We attempted to relax this requirement, however, we didn't account for whitespace that may follow the if line. So, first try modifying your rule so that the opening brace '{' starts at the end of the line.

     

     

    Also, any evaluation errors would be reported to the /var/log/ltm file. You should check there that you aren't running into some other error.

     

     

    Other than that, I certainly don't see any problems with your rule.

     

  • thanks for you read my of a kind english and reply !!!

     

    I have already tried on , I got same result as before modify,

     

    I have already read /var/log/ltm file, no information about this rule in it.