Forum Discussion
David_Barthel_1
Nimbostratus
Oct 08, 2007Selecting the pool member to which I want to persist
We have a need to be able to quickly confirm that a pool member has become partially disabled. Ideally, a monitor would serve this purpose, but it would be required to navigate through a number of layers including authentication in order to reach the
necessary level of testing within the web application. Does anyone have an example of a more sophisticated monitor used for this type of health check?
That question aside, it would still be useful for us to be able to persist to a particular pool member for testing purposes. One solution I've explored is to set up a virtual with no default pool but with a one connect profile. I created a number of single-server pools, one for each node used in our production pools. I then append ?testpool=server1-pool to any working URL, and employ a "pool cue" iRule which looks like:
when HTTP_REQUEST {
if { [string match "*testpool=*" [ HTTP::uri] ] } {
Split the URI on its question mark (?) into
mainparts list.
set mainparts [split [ HTTP::uri ] ?]
Set the newurl to the first of the mainparts of the
URI (everything before the question mark).
set newurl [lindex $mainparts {0}]
set new_qs ""
Initialize the delimiter to a question mark (?).
set delimiter "?"
Split the second element of mainparts list on
ampersand (&) into a list of parameters, then split
each parameter on the equals (=) sign.
foreach thisparam [split [ lindex $mainparts {1} ] & ] {
foreach {name value} [ split $thisparam = ] {
If the parameter name is "testpool",
then set the requested_pool var.
if { [string match "testpool" $name] } {
set requested_pool $value
Otherwise, append the parameter to the newurl.
} else {
set newurl "$newurl$delimiter$name=$value"
set new_qs "$new_qs$delimiter$name=$value"
Now that delimiter has been used once,
set it to an ampersand (&) for subsequent vars.
if { [string match "?" $delimiter]} {
set delimiter "&"
}
}
}
}
HTTP::uri $newurl
log local0. "pool requested: $requested_pool"
pool $requested_pool
}
}
The rule is not yet trapping for nonexistent pools, and errors in those instances, but seems to work for single-page tests of existing pools. Setting a one connect profile for this virtual allows me to revisit the URL without the testpool=server1-pool parameter, and it will still persist without using the irule. However, I've noticed that if I reload the page too fast, the LTM seems to lose the connection or open a new one, such that the browser's connection is reset. Am I on the right track here, or is this a dead-end? Have I made this overly-complicated?
I've seen a number of posting here wherein folks are trying to maintain a member persistence on subsequent requests, but can anyone advise me on how to initially persist to a particular member?
Thanks,
dave
No RepliesBe the first to reply
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects