Better Round Robin

Problem this snippet solves:

Implements Round Robin LB to avoid CMP idiosyncracies

How to use this snippet:

Attach this iRule to virtual server

Code :

when RULE_INIT {
    set static::betterRoundRobinDebug 1
}

when CLIENT_ACCEPTED {
    set betterRoundRobinPoolMemberPick [lindex [active_members -list [LB::server pool]] [expr {[table incr [virtual]_count] % [active_members [LB::server pool]]}]]
    if {$static::betterRoundRobinDebug} {
        log "LB Pool: [LB::server pool] - ActiveMembersList: [active_members -list [LB::server pool]] - Attempt to Pick: $betterRoundRobinPoolMemberPick"
    }
    pool [LB::server pool] member [lindex $betterRoundRobinPoolMemberPick 0] [lindex $betterRoundRobinPoolMemberPick 1]
}

Tested this on version:

12.1
Published Feb 15, 2017
Version 1.0
No CommentsBe the first to comment