Forum Discussion
saravana_kumar
Sep 04, 2020Nimbostratus
Virtual server connection limite through iRule
Need iRule help connection limite and redirection Requirement : we have two set of pool A & B, pool A having 8 nodes, Pool B having 3 node We have to limit the connection 3000 on poo...
Andrew-F5
Sep 30, 2020Employee
You can probably reference this other DevCentral post to get most of the way to your goal, https://devcentral.f5.com/s/question/0D51T00006i7TIA/connection-limit-on-virtual-server
The iRule below is an example I created but has not been tested for functionality or requirements.
when RULE_INIT {
set ::active_connections 0
set ::max_connections 3000
}
when CLIENT_ACCEPTED {
#Check if we're over the maximum allowed connections
if {$::active_connections > $::max_connections } {
# We're over the max, send to pool B
pool B
} else {
# We're not over the max, so send to Pool A and increment active_connections
incr ::active_connections 1
pool A
}
}
when CLIENT_CLOSED {
# A connection was closed, so decrement the global counter
incr ::active_connections -1
}
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