Forum Discussion
AndrewM_4835
Nimbostratus
Jun 11, 2008Hash Load Balancing
Dear Forum,
I am looking at trying an iRule to persistently load balance a group of web servers.
I have found an article 'Hash Load Balancing and Persistence on BIG-IP LT...
AndrewM_4835
Nimbostratus
Jun 23, 2008In LTM 9.2.4 md5 returns a string and not a number - is this different in 9.4?
which is why
set test [ [ expr [md5 {[findstr [HTTP::uri] "SRV=" 4 2]} ] % [llength $active_server_list] ]]
doesn't work.
where string looks like http://.../blubber?SRV=xx where xx is a number between 00 and 99.
I also tried using crc32 - but I found that with only 100 different possibilities, it didn't spread the load evenly enough.
My rule so far without checking for an empty string in SRV, or that they aren't numbers between 00 and 99, and that at least one server is working:
when HTTP_REQUEST
{
log local0. "Request: [HTTP::uri]"
set search_server_list { {10.0.164.11 20001}
{10.0.164.11 20002}
{10.0.164.11 20003}
}
set active_server_list {}
foreach node_address $search_server_list
{
if { [LB::status pool search_hash_pool member [lindex $node_address 0] [lindex $node_address 1]] eq "up" }
{
lappend active_server_list $node_address
}
}
set picked [ lindex $active_server_list [expr {[findstr [HTTP::uri] "SRV=" 4 2]} % {[llength $active_server_list]}] ]
pool search_hash_pool member [lindex $picked 0] [lindex $picked 1]
}
I tried adding the set search_server_list to RULE_INIT, but unfortunately no longer had access to it in the event, which means I need to reset its value every HTTP_REQUEST event....
After doing all of this, I will probably upgrade to 9.4.x as this all feels nasty - haven't had a chance to performance test it yet though.
Any thoughts or comments?
Thanks
Andrew
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