Priority in F5 iRule to resolve pool members not receiving any traffic

Are you experiencing problem of no traffic directed to a pool members?

Have you got multiple iRules associated to a specific virtual server and do you experience problem with the order of iRule being executed?

The solution to above problems is defining Priority in F5 iRule.

Know About iRule behavior

  • iRules are loaded into an iRule engine for the specific Virtual Server and they are stored in a table with event name and priority.
  • If Priority is not defined, default value of 500 is considered for an event.
  • Lowered numbered priority events are given preference and evaluated first before higher numbered priority events.
  • Priority value can be between 1 and 1000.

 

Define Priority in iRule

Method 1: Use Priority on top of set of events. In this case, same Priority will be designated for all subsequent events

Priority of CLIENT_ACCEPTED  is 1, the lowest is executed and followed by HTTP_REQUEST and HTTP_RESPONSE of Priority 7.

Priority 7
when HTTP_REQUEST {
set myuri [HTTP::uri] 
}
when HTTP_RESPONSE {
set node [IP::server_addr]
}
Priority 1
when CLIENT_ACCEPTED {
set client_address [IP::client_addr]
}

Method 2: Use Priority as an argument to an event. In this case, only this event will be designated with the priority.

Priority of HTTP_RESPONSE is default value 500. Hence events are still executed in the order of CLIENT_ACCEPTED, HTTP_REQUEST and finally HTTP_RESPONSE.

when HTTP_REQUEST Priority 7 {
set myuri [HTTP::uri] 
}
when HTTP_RESPONSE {
set node [IP::server_addr]
}
when CLIENT_ACCEPTED Priority 1 {
set client_address [IP::client_addr]
}