GTM Selective Persistence

Problem this snippet solves:

GTM has the ability to persist client requests to a virtual (or real) server for a configurable duration. This persistence is set at the Wide IP level, and is a yes/no proposition. There is no configuration option to selectively set persistence. GTM hasn't yet implemented a persist command like the one that is available in LTM iRules either. But as usual, there is another way to solve the problem with F5 gear, courtesy of your friendly neighborhood F5 Support Team!

Utilizing iRules to inspect the source of the request, you can use the cname command to redirect selected queries from a persistence-enabled WideIP to a Wide IP defined on the GTM where persistence is not configured.

To configure this scenario, define two Wide IP's, one with persistence and one without. Apply the iRule below to the persistence enabled Wide IP. The iRule checks for known source addresses for which persistence is not required and sends a CNAME redirect to a Wide IP with no persistence.

How to use this snippet:

iRule Source: GTM Selective Persistence

rule "SelectivePersist-rule" { when DNS_REQUEST { if { [IP::addr [IP::client_addr] equals 10.1.0.0/16] \ or [IP::addr [IP::client_addr] equals 10.2.0.0/16] } { cname "myService-noPersist.gtm.example.com" } } }

GTM doesn’t yet support class lists, but when it does, you’ll be able to create a class lookup instead of nested elseif’s for longer lists of addresses.

In the meantime, as an alternative, you could use regions and the matchregion command to avoid multiple IP::addr executions.

Code :

# Wide IP Definitions

# Wide IP with Persistence and iRule

wideip {
   name         "myService.gtm.example.com"
   persist      yes
   persist_ttl  1800
   pool_lbmode  rr
   pool         "myPool"
   rule         "SelectivePersist-rule"
}


# Wide IP with No Persistence

wideip {
   name         "myService-noPersist.gtm.example.com"
   pool_lbmode  rr
   pool         "myPool"
}
Published Mar 17, 2015
Version 1.0
No CommentsBe the first to comment