Forum Discussion
Route Connections for a Partcular Service to a Backup Pool for the Duration that a Connection Count is Reached
For one of our services the connections are much higher versus the others in general.There are specific situations where there can be much more connections for this service. When these situations occur; performance degrades for other services as well.
I was wondering if I can check the routing URI for this specific service, check if active connections have reached a certain count (coming from a particular client IP); and if the limit has been reached then route the traffic to another pool (which has standby VMs with no traffic for any other services on them).
In theory we would route to this other pool until the number of connections has gone below this threshold coming from this Client IP. The idea is that this could improve performance and limit the issues in general for all of our services.
The following is a concept I put together using logic found in this thread: https://devcentral.f5.com/questions/help-need-to-create-a-irule-for-limit-client-connection
===iRule Source===
when RULE_INIT {
This defines how long is the sliding window to count the requests. This example allows 100 requests in 30 seconds
set static::windowSecs 30
set limit 100
}
when HTTP_REQUEST { if {[HTTP::uri] contains "/ServiceX"} {
if { $limit ne "" } {
set getCount [table key -count -subtable [IP::client_addr]]
log local0. "[IP::client_addr]: getCount=$getCount"
if { $getCount < $limit} {
incr getCount 1
table set -subtable [IP::client_addr] $getCount "" indefinite $static::windowSecs
} else { log local0. "[IP::client_addr]: exceeded the number of requests allowed for ServiceX- rerouting service X requests. $getCount / $limit"
pool Service_X_Pool
}
}
} }
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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