Forum Discussion

Zoltan_101727's avatar
Zoltan_101727
Icon for Nimbostratus rankNimbostratus
Oct 04, 2012

iRules to enable universal persistence not enabling persistence

Here's the setup:

 

I have a virtual server. I have 2 iRules (see below) assigned to it as resources.

 

From the server log it looks like that the rules are running and they select the correct member

 

from the pool after persisting the session (as far as I can tell based on my log messages), but the requests are ultimately directed to somewhere else.

 

Here's how both rules look like:

 

when HTTP_RESPONSE {

 

set sessionId [HTTP::header X-SessionId]

 

if {$sessionId ne ""} {

 

persist add uie $sessionId 3600

 

log local0.debug "Session persisted: <$sessionId> to <[persist lookup uie $sessionId]>"

 

}

 

}

 

 

when HTTP_REQUEST {

 

set sessionId [findstr [HTTP::path] "/session/" 9 /]

 

if {$sessionId ne ""} {

 

persist uie $sessionId

 

set persistValue [persist lookup uie $sessionId]

 

log local0.debug "Found persistence key <$sessionId> : <$persistValue>"

 

}

 

}

 

According to the log messages from the rules, the proper balancer members are selected.

 

Note: the two rules can not conflict, they are looking for different things in the path. Those two things never appear in the same path.

 

Notes about the server:

 

The default load balancing method is RR.

 

There is no persistence profile assigned to the virtual server.

 

I'm wondering if this should be adequate to enable the persistence, or alternatively, do I have

 

to combine the 2 rules and create a persistence profile with them for the virtual server?

 

Or is there something else that I have missed?

 

5 Replies

  • have you tried oneconnect profile?

     

     

    sol7964: Persistence may fail for subsequent requests on Keep-Alive connections

     

    http://support.f5.com/kb/en-us/solutions/public/7000/900/sol7964.html
  • Not trying to persist server responses. I'm adding the server that server the request to the "persistence map" with the key that is in that response header (persist add uie ...) . Subsequent requests containing that same key will be server by the same server as the one that had the key/sessionid in the response (persists uie ...). At least that's the intent.
  • As the link by nitass suggested, I've modified the rule to make sure that keep-alive connections are not interfering with the session persistence:

     

     

    if {$sessionId ne ""} {

     

    Added this line:

     

    LB::detach

     

     

    persist uie $sessionId

     

     

    set persistValue [persist lookup uie $sessionId]

     

     

    log local0.debug "Found persistence key <$sessionId> : <$persistValue>"

     

     

    }

     

     

    Thanks!