Forum Discussion
Content Based Routing via iRule
Hey all,
We've implemented an iRule for an application's VIP that parses the HTTP URI and based on the contents, the iRule LBs to one of 12 pools of servers.
switch -glob $lowerURI {
"*/s1/*" {
pool $pool1
if { $log_value > 1 } {log local0. "$log_prefix: s1: setting poolname as: $pool1"}
STATS::incr $stats_profile slot_slot1
}
"*/s2/*" {
pool $pool2
if { $log_value > 1 } {log local0. "$log_prefix: s2: setting poolname as: $pool2"}
STATS::incr $stats_profile slot_slot2
}
"*/s3/*" {
pool $pool3
if { $log_value > 1 } {log local0. "$log_prefix: s3: setting poolname as: $pool3"}
STATS::incr $stats_profile slot_slot3
}
etc.
Where we are running into a problem (it seems), is when a single clientside TCP connection passes multiple requests to the LTM. For example, the first HTTP request on the clientside is for Pool1 ( /s1/ ). The LTM builds the serverside TCP connection to the pool 1 member.
Then, via the already established clientside TCP connection, the client sends another HTTP request that needs to be LB'ed to Pool2 ( /s2 ).
From the traces, it "looks" like the LTM closes the serverside TCP connection to the pool 1 member and initiates a new serverside TCP connection to the pool 2 member.
At this point, that all makes sense. We wouldn't want LTM to have one clientside TCP connection and multiple serverside TCP connections.
The behavior that I am trying to understand is in the situation where multiple requests are hitting the VIP and subsequently the iRule for the same pool.
Will the LTM close a connection to Pool 1 pool member, only to re-open it for the exact same member?
We have a firewall in between the LTM and the pool members (PCI Zone) and it seems that the close and immediate re-open of the exact same connection is causing the firewall to drop traffic.
The firewall thinks it is a duplicate connection because when the initial connection is closed, lets say TCP Source 61489 to TCP Dest 80. When the LTM re-initiates the connection, it has to use the same source port (the clienside connection is still up), the firewall sees Source 61489 to Dest 80. It then interprets that as a dupe connection and drops.
Please let me know if you have any insight on how the LTM would manage serverside TCP connections under an iRule of this nature
- Mohamed_Lrhazi
Altocumulus
Do you have "Port Translation" disabled on the VS? The client side source port and server side one need not be kept the same. - hoolio
Cirrostratus
I agree with Mohamed that adding a OneConnect profile to the virtual server should improve this. - Luke_Lehman
Employee
Thanks guys! I will say that I've been doing numerous captures of the conversations. We also opened a support case and the tech also recommended OneConnect. - Luke_Lehman
Employee
Also, to answer Mohamed's question - we have "Preserve" configured for "Source Port." I've never used anything but the default, Preserve. Would this be a second option if OneConnect doesn't work out? - Mohamed_Lrhazi
Altocumulus
The behavior is odd, and I would think F5 should help you at least understand it, before you permanently change your setup, such as by using OneConnect.... - Michael_Yates
Nimbostratus
@Mohamed
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