Forum Discussion
UIE string based persistence help
Hello,
I have a rule that was working 95% of the time in regards to UIE string based persistence, but sometimes the string was routed to 2 pool members. I can see in the uie persistence table the few occasions where the string is the exact same string but is sent to different pool members. For the most part it works correctly but I need to have it working 100%. any pointers or tips on the best way forward is greatly appreciated!!
I have an application that creates two sockets, in each the string is parsed correctly and is required to go to the same pool member. The sockets are opened anywhere from 1 to 3 seconds apart. I read some articles that explain where to persist uie and when to add persist add uie and I recently modified the rule to use LB_Selected event, however now im getting some TCL errors about the LB_selected event cantt find the variable used in the CLIENTSSL_Data event.
Here is the current Irule:
Code
when CLIENTSSL_HANDSHAKE {
log local0. "[IP::client_addr]:[TCP::client_port]: SSL handshake completed, collecting SSL payload"
SSL::collect
}
when CLIENTSSL_DATA {
set payload [SSL::payload]
if { $payload contains "SOR" } {
log local0. "Aggregator first socket initiated using SOR message parsing"
Now execute first string match for the first socket
set entityID [findstr $payload "@" 1 ","]
pool xyz
log local0. "Here is the first TCP socket entity $entityID"
persist uie $entityID 1800
SSL::release
} elseif { $payload contains "LI" } {
log local0. "App second socket initiated using LI message parsing"
Now execute second string match for the first socket
set entityID2 [findstr $payload "@" 1 "null"]
log local0. "Here is the second TCP socket entity $entityID2"
pool xyz
persist uie $entityID2 1800
log local0. "Entity Session routing for $entityID2 and setting persistence"
SSL::release
} else {
log local0. "No match is found"
}
}
when LB_SELECTED {
add server info to session table when server selected
only add if key exists & node not directly selected above
if {$entityID != "" }{
session add uie $entityID [LB::server addr]:[LB::server port]
log local0. "$entityID has been sent to [LB::server addr]:[LB::server port]"
} elseif {$entityID2 != "" }{
session add uie $entityID2 [LB::server addr]:[LB::server port]
log local0. "$entityID2 has been sent to [LB::server addr]:[LB::server port]"
}
}
- What_Lies_Bene1Cirrostratus
Hmmm. I'm not sure about the whole LB_SELECTED part really. Regardless, I think you need a space between the first { of each if/elseif statement and the variable name. Same goes for the }{'s.
I don't quite understand how you are identifying that the second connection is from the same host as the first. If the data found by each findstr command is the same then why persist using two variables? Also, shouldn't the block for the first connection use
and the block for the second just usepersist add
?persist
- jgranieriNimbostratus
Thanks for the helpful tips
I haven't tried removing the second persist command so that is something I can easily try and report back.
Also I will try the persist add on the 1st socket and then simply the persist command on the second.
I only recently added the LB_SELECTED event because a dev central article recommended, here is an excerpt from that:
To add a record to the persistence table, run the “persist add” command after the persistence token can be associated with the persistence target. (LB_SELECTED is the first event in the serverside request context, and would be a logical place to run the command).
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com