Is my persist record getting ignored?
I posted a similar question a few months back, but I still seem to be having trouble with using an iRule to manage persistence between clients and servers. Basically, the situation is the servers provide a transaction ID that I use as the key for a uie persist record. I seem to be capturing the transaction ID correctly, and I am able to add and delete the entries from the persist records table, but for some reason the LTM is occasionally forwarding some of the requests to the wrong server. Here is the iRule that creates the persist record:
when HTTP_RESPONSE {
make sure Location and transaction exist
if {[HTTP::header exists Location] && [string match *transactions* [HTTP::header 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 300
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]"
}
}
}
And here is the iRule that watches for subsequent requests to either use the persist entry or to remove it:
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], $Transaction_ID persist record does not exist"
} else {
check if transaction is closed by PUT with ContentLength=0
if {[HTTP::method] equals "PUT" && [HTTP::header Content-Length] equals "0"} {
log local0. "End of transaction $Transaction_ID method: [HTTP::method], length: [HTTP::header Content-Length]"
persist delete uie $Transaction_ID
} else {
use existing persist record
log local0. "[IP::client_addr]:[TCP::client_port] [HTTP::uri], transactionID: $Transaction_ID, existing persist record: [persist lookup uie $Transaction_ID]"
persist uie $Transaction_ID
}
}
}
}
I can see in the LTM log that the records are being added and deleted correctly, but a tcpdump on the servers shows that sometimes the requests are being sent to the wrong server. Am I using the persist statement correctly? Does "persist uie $Transaction_ID" tell the LTM to use this persist record? Is there a log I can check to see why it might be forwarding the request to the wrong server?
Thanks, Kevin