Forum Discussion

BaltoStar_12467's avatar
Oct 04, 2013

virtual-server with multiple irules : conditions of invocation

virtual-server-1
default pool-1

irule-1.conf 
priority 100
 for url A , conditional logic does to this line : 
pool pool-2


irule-2.conf
priority 110
 for url A , conditional logic goes to this line : 
pool pool-3

if request url A is sent to virtual-server-1 , to which pool is the traffic routed ?

i understand that irule-1 is invoked first ( priority=100 < priority=110 )

i'm wondering about the conditions for invocation of irule-2

is irule-2 always invoked following irule-1 ? ( so that for url A end result is route to pool-3 )

or is irule-2 only invoked if irule-1 does not perform an action ( route to pool , redirect back to client , rewrite to pool, etc ) ? ( so that for url A end result is route to pool-2 )

how does the virtual-server default pool ( pool-1) figure-in to this ? is traffic directed to pool-1 only for those cases where both irule-1 and irule-2 fail to perfom an action ?

6 Replies

  • from my understanding, you cannot guarantee invocation order.

     

    so if multiple conditions are met it could cause conflicts/errors.

     

    default pool is hit if no other conditions are met via irule, etc. on the vip - but you cannot rely on order from my experience.

     

    just my two cents

     

    cheers

     

    • My very limited experience ( this is first time I've created > 1 irule per virtual-server ) indicates ( via logs ) that indeed irule-1 ( priority 100 ) fires first , and once it is completed irule-2 ( priority 110 ) fires second ( always ). What I find non-intuitive is that if irule-1 routes the request to a pool , why does irule-2 fire at all ? In other words , why did f5 design it this way ? Also, another strange behavior I'm seeing is that after irule-2 routes to pool-3, irule-1 fires again, then irule-2 again. This repeated sequences occurs 7 times before ceasing. There are no site redirects in play here -- I've even performed a test where I stop the website and test and the f5 logs still show the same pattern of irule-1,irule-2,irule-1,irule-2,etc. What could be causing this behavior ?
  • uni's avatar
    uni
    Icon for Altostratus rankAltostratus

    Pool starts out as the default pool-1. Priority 100 rule gets executed, pool gets set to pool-2 Priority 110 rule gets executed, pool gets set to pool-3 Rule processing ends. Pool remains as pool-3.

     

    If you want it to stop rule processing in irule-1, add "event disable HTTP_REQUEST" (or just "event disable", as the current event is the default).

     

    If you do something like this, you should consider adding "event enable HTTP_REQUEST" in the HTTP_RESPONSE event, so subsequent HTTP requests on the same connection will get passed to the rules' events.

     

    • Thanks uni. On the topic of request on the same connection : does CLIENT_ACCEPTED get processed once per connection ? or once per request ?
  • Pool starts out as the default pool-1. Priority 100 rule gets executed, pool gets set to pool-2 Priority 110 rule gets executed, pool gets set to pool-3 Rule processing ends. Pool remains as pool-3.

     

    If you want it to stop rule processing in irule-1, add "event disable HTTP_REQUEST" (or just "event disable", as the current event is the default).

     

    If you do something like this, you should consider adding "event enable HTTP_REQUEST" in the HTTP_RESPONSE event, so subsequent HTTP requests on the same connection will get passed to the rules' events.

     

    • Thanks uni. On the topic of request on the same connection : does CLIENT_ACCEPTED get processed once per connection ? or once per request ?