cancel
Showing results for 
Search instead for 
Did you mean: 
Login & Join the DevCentral Connects Group to watch the Recorded LiveStream (May 12) on Basic iControl Security - show notes included.

Maintaining persistancy based on Unique transaction ID for 2 different URI

Amith_Rajgopal_
F5 Employee
F5 Employee

Team,

 

Explaining a bit about scenario. Customer has requirement of sending certain traffic to specific node within a pool for 2 different URI with same transactionID (attaching snapshot for 2 sample transcationID) . The objective is api /req and api /resp should land on same node. Below irule seems not working as expected. the below irule is attached to persistancy uie and attached to vs.

 

when HTTP_REQUEST {

set txnid [findstr [HTTP::uri] "urn:txnid:" 10 ";"]

# set txnid [string range $string1 10 end]

# log local0. " Printing txnid: $txnid for [HTTP::uri]"

if { $txnid != "" } {

persist uie $txnid

}

}

 

Have done a bit of modification, can you please look into this and suggest any modifications. The new sample irule:

when HTTP_REQUEST {   

  if { (([string tolower [HTTP::uri]] contains "/upi/respbalenq/") or ([string tolower [HTTP::uri]] contains "/upi/reqbalenq/") and ( [string tolower [HTTP::uri]] contains "/urn:txnid:auto" ) } {  

set txnid [findstr [HTTP::uri] "urn:txnid:" 10 ";"]

#set string1 [findstr [HTTP::URI] "urn:txnid:"]

#set txnid [string range $string1 10 end]

 Log local0. " Printing txnid: $txnid for [HTTP::uri}"

 if { $trxnid != ""} {

     persist uie $txnid

   pool inq_bal

   } else {

      return

  }

}

 

In the snapshot 10.20.210.22 is selfip and 10.20.19.99 / 100 / 101 are backend servers. Objective is if transaction ID is same for both api (req and resp) , it should always land on same node.

 

 

 

 

 

0691T00000CpCAJQA3.png0691T00000CpCAKQA3.png0691T00000CpCAcQAN.png

5 REPLIES 5

Hi Amith,

 

I think your iRule is missing the part when you add the persistence record. Example:

persist add uie [findstr [HTTP::uri] "urn:txnid:" 10 ";"]

Check here:

https://support.f5.com/csp/article/K7392

and here:

https://clouddocs.f5.com/api/irules/persist.html

 

With your iRule you are looking up a record that was never created.

Furthermore you can list existing persistence records and verify that your iRule works, see here:

https://clouddocs.f5.com/cli/tmsh-reference/v15/modules/ltm/ltm_persistence_persist-records.html

 

KR

Daniel

Thanks Daniel for response.

 

I am under impression persist add uie is to be used for http_response and we are not inspecting response of the server.

 

Am i going wrong in my understanding?

You are right with your understanding, it must be inserted as part of the response.

SanjayP
MVP
MVP

Can you try configuring oneconnect profile with /32 mask and see if that makes a diffrence? With oneconnect, F5 should detach the connection and reload-balance using persistence record per HTTP request.

Sure Sanjay. I will try Oneconnect too.