For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

Justin_C_163436's avatar
Justin_C_163436
Icon for Nimbostratus rankNimbostratus
Sep 30, 2014

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
                            }
            }

} }

No RepliesBe the first to reply