Forum Discussion
Limitation on LB::reselect?
I've coded an iRule that's supposed to search for a server that's not on an "avoid" list. I've tried to do this by doing LB::reselect repeatedly until I reach one that's not on the list. However, it's acting like LB::reselect can only select one new server in a given transaction. After that, it stays with the new server, even if LB::reselect is executed again.
Is this how it's supposed to work?
Here is the current text of my LB_SELECTED event:
when LB_SELECTED {
incr css_tries
log local0. "Server [LB::server addr]:[LB::server port] Tries $css_tries Avoid_list \"$css_avoid_list\" Active [active_members -list [LB::server pool]]"
if {[active_members [LB::server pool]] <= 1} {
No use trying
set css_add_header 0
} elseif {[lsearch -exact $css_avoid_list [LB::server addr]:[LB::server port]] >= 0} {
if {$css_tries < [active_members [LB::server pool]]} {
log local0. "On avoid list (try $css_tries), retrying"
LB::detach
LB::reselect
} else {
log local0. "Too many tries ($css_tries)"
Stay with the one we selected. Remember for the response.
set css_add_header 0
}
}
}
Craig Jackson
EBSCO Publishing
10 Replies
- nitass
Employee
i am having a similar problem too. i think LB_SELECTED is not triggered after executing 2nd LB::reselect command.[root@ve11a:Active:Changes Pending] config tmsh show sys version|head Sys::Version Main Package Product BIG-IP Version 11.3.0 Build 3022.0 Edition Hotfix HF3 Date Fri Feb 22 00:00:34 PST 2013 root@(ve11a)(cfg-sync Changes Pending)(Active)(/Common)(tmos) list ltm virtual bar ltm virtual bar { destination 172.28.20.16:80 ip-protocol tcp mask 255.255.255.255 pool foo profiles { tcp { } } rules { myrule } source 0.0.0.0/0 source-address-translation { type automap } vlans-disabled } root@(ve11a)(cfg-sync Changes Pending)(Active)(/Common)(tmos) list ltm pool foo ltm pool foo { members { 200.200.200.101:80 { address 200.200.200.101 } 200.200.200.102:80 { address 200.200.200.102 } 200.200.200.111:80 { address 200.200.200.111 } 200.200.200.112:80 { address 200.200.200.112 } } } root@(ve11a)(cfg-sync Changes Pending)(Active)(/Common)(tmos) list ltm rule myrule ltm rule myrule { when CLIENT_ACCEPTED { log local0. "--" set c 1 } when LB_SELECTED { log local0. "--" log local0. "\[LB::server\] [LB::server]" log local0. "\$c $c \[active_members foo\] [active_members foo]" if { $c < [active_members foo] } { LB::reselect log local0. "LB::reselect" incr c } } when LB_FAILED { log local0. "--" } when SERVER_CONNECTED { log local0. "--" log local0. "server [IP::remote_addr]:[TCP::remote_port]" } } /var/log/ltm [root@ve11a:Active:Changes Pending] config tail -f /var/log/ltm Mar 11 14:15:40 ve11a info tmm[10597]: Rule /Common/myrule : -- Mar 11 14:15:40 ve11a info tmm[10597]: Rule /Common/myrule : -- Mar 11 14:15:40 ve11a info tmm[10597]: Rule /Common/myrule : [LB::server] /Common/foo 200.200.200.101 80 Mar 11 14:15:40 ve11a info tmm[10597]: Rule /Common/myrule : $c 1 [active_members foo] 4 Mar 11 14:15:40 ve11a info tmm[10597]: Rule /Common/myrule : LB::reselect Mar 11 14:15:40 ve11a info tmm[10597]: Rule /Common/myrule : -- Mar 11 14:15:40 ve11a info tmm[10597]: Rule /Common/myrule : [LB::server] /Common/foo 200.200.200.102 80 Mar 11 14:15:40 ve11a info tmm[10597]: Rule /Common/myrule : $c 2 [active_members foo] 4 Mar 11 14:15:40 ve11a info tmm[10597]: Rule /Common/myrule : LB::reselect Mar 11 14:15:40 ve11a info tmm[10597]: Rule /Common/myrule : -- Mar 11 14:15:40 ve11a info tmm[10597]: Rule /Common/myrule : server 200.200.200.102:80
- Craig_Jackson_2
Nimbostratus
I actually do get one more LB_SELECTED event. But not two. - Craig_Jackson_2
Nimbostratus
I should mention that this is on 11.2.0. - Craig_Jackson_2
Nimbostratus
Also, I'm testing on a 1600 with 2 processors, where I'm seeing this behavior. - nitass
Employee
i have opened a case since a few days back to check whether it is expected behavior (i do not think it is anyway). i will post here when getting feedback. - nitass
Employee
i was told it is by design. :-/
- Craig_Jackson_2
Nimbostratus
I should hope that you have suggested that this design decision be documented? - nitass
Employee
this is an answer from escalation engineer. - Craig_Jackson_2
Nimbostratus
Ahh. So it's a recursion issue. I wasn't thinking of LB_SELECTED being called directly out of the previous LB::reselect event, but I guess it is. - What_Lies_Bene1
Cirrostratus
Wouldn't the Priority Group Activation feature meet your requirements?
Recent Discussions
Related Content
* 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