Forum Discussion
Vincent_96516
Apr 17, 2012Nimbostratus
Message based load balancing connection status
I am creating irules script to work under message based load balancing profile (mblb), the following are some issues I have (OS v.10.2.3):
(1) When there are no active members in the pool (all backend nodes are down), how can I close the client connection?
The following are the script I use:
when SERVER_CLOSED {
log local0. "Server connection closed to [IP::server_addr]."
if { [active_members [LB::server pool]] == 0 } {
clientside {
TCP::close
log local0. "TCP connection closed to [TCP::local_port]."
}
}
}
but the client connection is not closed. Are there any mblb related configuration for this?
(2) In one of our virtual server, server side will initial request, client will sent response. To maintain the backend connections (connections between LTM and server nodes), I set up a timer to broadcast ping message to all backend nodes as following:
when SERVER_CLOSED {
log local0. "Server connection closed to [IP::server_addr]."
if { [active_members [LB::server pool]] == 0 } {
clientside {
TCP::close
log local0. "TCP connection closed to [TCP::local_port]."
}
} else {
if { [info exists status_timer] } {
$timer exists, do nothing
} else {
log local0. "Set status timer"
set status_timer [after 30000 -periodic {
clientside {
foreach m [active_members -list [LB::server pool]] {
pool [LB::server pool] member [lindex $m 0] [lindex $m 1]
log local0. "send status ping to $m"
TCP::payload replace 0 0 $static::conn_ping
TCP::release 2
TCP::notify request
}
}
}]
}
}
}
The timer is set, but the ping message was not sent. Is there anything wrong with the code? $static::conn_ping is a 2 bytes ping message.
2 Replies
Sort By
- Hi Vincent,
example I when CLIENT_ACCEPTED { check every second after 1000 -periodic { if { [active_members [LB::server pool]] == 0 } { reject log local0. "TCP connection closed to [TCP::local_port]." } } } example II when CLIENT_ACCEPTED { array set server_array {} check every second after 2000 -periodic { if { [array size server_array] == 0 } { reject log local0. "TCP connection closed to [TCP::local_port]." } } } when SERVER_CONNECTED { set s "[IP::remote_addr] [TCP::remote_port]" set server_array($s) 1 } when SERVER_CLOSED { set s "[IP::remote_addr] [TCP::remote_port]" unset server_array($s) }
- Thanks Nat for the suggestions.
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