Forum Discussion

Kevin_M_182964's avatar
Kevin_M_182964
Icon for Nimbostratus rankNimbostratus
Jan 16, 2015

do I need to add a persist entry, or does calling persist suffice?

I am trying to create persistent connections based on a transaction ID that is passed from the server to the client. I first grab the transaction ID in the header of the response from the server:

when HTTP_RESPONSE {
  if {[HTTP::header exists Location]} {
     get everything right of /transactions/ up to next /
    set Transaction_ID [findstr [HTTP::header Location] "/transactions/" 14 /]
     if persist record doesn't exist, create one
    if {[persist lookup uie $Transaction_ID] equals ""} {
      persist add uie $Transaction_ID 60
      log local0. "[IP::client_addr]:[TCP::client_port], transaction ID: $Transaction_ID, created persist record: [persist lookup uie $Transaction_ID]"
    } else {
      log local0. "[IP::client_addr]:[TCP::client_port], transaction ID: $Transaction_ID, existing persist record: [persist lookup uie $Transaction_ID]"
    }
  }
}

I then check the subsequent requests from the client for the transaction ID in the URI:

when HTTP_REQUEST {
  if { [HTTP::uri] contains "/transactions/" } {
     get field from /transactions/ to next /
    set Transaction_ID [findstr [HTTP::uri] "/transactions/" 14 "/"]
     check if persistence record exists for this transaction
    if {[persist lookup uie $Transaction_ID] equals ""} {
      log local0. "[IP::client_addr]:[TCP::client_port][HTTP::uri], persist record does not exist"
    } else {
      persist uie $Transaction_ID
      log local0. "[IP::client_addr]:[TCP::client_port][HTTP::uri], transactionID: $Transaction_ID, existing persist record: [persist lookup uie $Transaction_ID]"
    }
  }
}

Am I doing this right? I see two entries for each transaction ID in the persistence table. My interpretation of the persist add uie $Transaction_ID 60 statement is that it is adding an entry to the table, and persist uie $Transaction_ID is assigning this request to the pool member listed in the record. Is that how it works?

2 Replies

  • Hi Kevin,

    seeing multiple persistence records may be caused by the parallel processing in your BIG-IP (CMP, clustered multi processing).

    Persistence records need to be distributed to each TMM instance and that´s why they my be dumped multiple times.

    I guess you see at the end of each persistence record different entries for tmm instances (i.e. tmm: 0, tmm: 1).

    Both records should point to the same pool member.

    Using the following command provides a more detailed view and perhaps you spot another difference in case my assumption is wrong:

    tmsh show ltm persist persist-records all-properties

    Thanks, Stephan

  • Sounds like I'm doing it right then. I do see that the entries list different TMM instances. Thanks!