Forum Discussion

BaltoStar_12467's avatar
Sep 23, 2015

BIG-IP : under what conditions does LB_SELECTED event fire ?

F5 BIG-IP Virtual Edition v11.4.1 (Build 635.0) LTM on ESXi

Under what conditions does the

LB_SELECTED
event fire ?

If within an iRule's

HTTP_REQUEST
event-processing-block the pool is explicitly set :

when HTTP_REQUEST {
  pool "my-pool-01"
}

it appears this will trigger the

LB_SELECTED
event ( following execution of all
HTTP_REQUEST
event-processing-blocks ).

But what about the case where the pool is not explicitly set within any iRule , but the virtual-server routes traffic to default pool ?

In this scenario , will the

LB_SELECTED
event still fire ?

Also, do

LB_SELECTED
event-processing-blocks fire only after all
HTTP_REQUEST
event-processing-blocks have completed ? So for a stack of 2 iRules, if I have
HTTP_REQUEST
blocks in iRules 1 & 2 , will an
LB_SELECTED
block in iRule 1 begin execution only after the
HTTP_REQUEST
block in iRule 2 has completed execution ?

Another question : my event logs seem to indicate that for a client's initial request upon selecting a pool member the

LB_SELECTED
event will fire, but not re-fire for subsequent requests by same client to the same back-end server. Is this due to keep-alives establishing a session where selected pool node is maintained for session duration ? Or why else would
LB_SELECTED
event no longer fire ?

  • Yes, LB_SELECTED should be triggered when a load balancing decision is made regardless of what triggers the decision. This happens even if you manually specific a pool or node in an iRule:

     iRule
    when HTTP_REQUEST {
        node 10.128.10.252
        log local0. "selected [LB::server]"
    }
    when LB_SELECTED {
        log local0. "here"
    }
    
     /var/log/ltm output:
    : selected 10.128.10.252 0
    : here