Forum Discussion

playfair039_320's avatar
playfair039_320
Icon for Nimbostratus rankNimbostratus
Mar 28, 2018

Persistence

I have a pool of 8 tomcat servers that connect to a group of 2 downstream application servers. I use destination address persistence so that it doesn't matter which server and the only cause of a failover is that the "active" server fails. The requirement has changed slightly so we need 2 groups of 4 tomcat servers each connecting to one of the application servers and only failing over when the preferred application server for that group fails. I've used data-groups to implement this in an irule

if {( [class match [IP::client_addr] equals datagroup1] ) && ([active_members pool] > 1 ) } {
    node poolmember1 8990
  }elseif ...

The issue is that when the preferred application server recovers, irule causes the tomcat servers to force their way back to the preferred server which causes instability for users. The preferred solution is that the connections remain until there is a failure. Any ideas would be much appreciated

1 Reply

  • A solution here was to use source_addr persistence - only gets inserted when there's been a failover and check if there is an active persistence session before directing the tomcat instances to an application server.

    when request {
      set persistenceRecord [persist lookup source_addr [IP::client_addr]]
      if { $persistenceRecord eq "" }{
        if {([class match [IP::client_addr] equals dg1]) && ([active_members pool] > 1 )}{
          pool pool member 1.1.1.1 [port]
         } elseif {([class match [IP::client_addr] equals dg2]) && ([active_members pool] > 1 )} {
          pool pool member 2.2.2.2 [port]
         } else {
         pool pool
         persist source_addr ...
    

    Because a persistence record only gets inserted if/when we hit the default else of that block, we maintain those persistence sessions and never fail back + we only ever get into the block if no persistence records exist to begin with.