Forum Discussion
danielo303_1961
Nimbostratus
Feb 17, 2012iRule: redirect to pool based on app response time?
I would like to use an iRule to direct traffic based on the response time of the back-end resource pool. Under normal operations, incoming requests (these are SOAP-based queries) will go to the primary resource pool. When the primary pool becomes unresponsive (response slower than 5-10 seconds), requests should be directed to a secondary pool which is configured to basically tell the client "come back later".
I am using priority groups and health monitors to approximate this mechanism currently. But I think if I could find the right tools in iRule I would have more precise control.
Basically I need something like:
when HTTP_REQUEST {
[code to check response time here...]
if response_time < 10 {
pool primary_pool
return
}
else {
pool secondary_pool
return
}
}
Is there a command to test the back-end response? We are on BIG-IP 9.4.3
Thanks!
4 Replies
- Hamish
Cirrocumulus
Hmm...
9.4.3 makes it a bit more difficult. I did something for this in 2010 on LDAP servers. But the iRule was designed to be pretty lightweight and the actual calculations for average response times etc was offloaded to a separate server, because different users were expected to have different SLA requirements. (See the LDAP_Stats_Measuring iRule).
The measurements and tracking of response times was tracked by user (ldap bind id), but it required tables. Assuming you don't need that... Hmm.. Not sure. Would need a bit more thought. Any chance you could upgrade to v10.2?
Even then though, you have the problem of working out when the response times decrease again... v11 you could use a sideband connection...
More thought required...
H - hoolio
Cirrostratus
You could use the after command in 10.0+ to set a timer and select a new pool if the currently selected server doesn't reply. I think you'd need to call LB::detach in the after script and then call the second pool using the pool command.
See the last example on the wiki page for details:
http://devcentral.f5.com/wiki/iRules.after.ashx
http://devcentral.f5.com/wiki/iRules.lb__detach.ashx
Aaron - hoolio
Cirrostratus
Or instead of selecting another pool, you could just send the response content from the iRule itself using HTTP::respond:
http://devcentral.f5.com/wiki/iRules.http__respond.ashx
Aaron - danielo303_1961
Nimbostratus
Hoolio, Hamish
Thanks so much for the suggestions. Looks like we need to be on 10.0 to really achieve the result we want. I'll tell my boss it's time to upgrade ;-)
Daniel
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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