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 LTM' which does pretty much what I want to do - only I am running 9.2 on a pair of 6800s and the "active_members –list" does not exist.
when HTTP_REQUEST {
set picked [lindex [active_members –list test_pool] [expr [md5 [findstr [HTTP::uri] "SER=" 4 2]] % [active_members test_pool]]]
pool test_pool member [lindex $picked 0] [lindex $picked 1]
}
- but this doesn't work on 9.2
There are 12 servers in the test_pool, and I want all requests that have the same "SER=xx" to be sent to the same backend server...
Any suggestions?
(And please don't say upgrade)
Andrew
- The_Bhattman
Nimbostratus
Here is a piece of logic that may help.. . . set active_members { } set pool_list { 192.168.1.10 192.168.1.12 192.168.1.13 192.168.1.14 ... etc. } foreach node_address $pool_list { if {LB:status pool test_pool member $node_address eq "up" } { lappend active_members $N } } . . .
- Mark_Melin_6298
Nimbostratus
I got this kind of thing working nicely, however, i am on 9.4.3 so.... - AndrewM_4835
Nimbostratus
The solution with checking which nodes are currently active myself seems a little slow - and I can't imagine it scales very well... - The_Bhattman
Nimbostratus
If you refering to the one I posted, I have already tried this on a ~100,000 connections/sec and apparently it works just fine. What doesn't scale well is adding the multiple IP addresses. However, if you see that it's slowing you down then it's possible that it's plateform dependent performance OR settings dependent. Currently, I am using it on several 8400s and 6400 LTM. - AndrewM_4835
Nimbostratus
In LTM 9.2.4 md5 returns a string and not a number - is this different in 9.4?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] }
- AndrewM_4835
Nimbostratus
Modified version with error checkingwhen HTTP_REQUEST { 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 } } if {[catch {set server_number [expr {[findstr [HTTP::uri] "SRV=" 4 2]} % {[llength $active_server_list]}] }]} { pool search_hash_pool } else { set picked [ lindex $active_server_list $server_number ] pool search_hash_pool member [lindex $picked 0] [lindex $picked 1] } }
- AndrewM_4835
Nimbostratus
This rule has been up and running for about a month now. - Patrick_Chang_7Historic F5 Accountmd5 produces a string. You can use the binary scan command to convert this to an integer. see the election hash iRule to see how this works.
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