I am trying to write an irule that will do the following:
1) limit the web servers to 50 connections each.
2) any connection after 50 will be redirected to another site.
3) Clients are using cookies for persistence.
4) Once a client gets a cookie we need to keep persistence.
rule session_limit {
my qustion is - i
1)Is the max_active_clients- of 50, is that for the pool or each member?
2) How do we guarantee that we always send users to a server that has the capacity? We notice - that when we have a few connections available on a server. We will still get redirected – for example - one servers will have 40 connections- the other about 10. So we will get redirted - in this case to yahoo. Is there a way to set the limit on the per node basis? It looks like we are setting the limit on the per vip basis.
Below is what we have:
rule session_limit {
when RULE_INIT {
array set ::active_sessions { }
set ::total_active_clients 0
set ::max_active_clients 50
}
when HTTP_REQUEST {
if { [HTTP::cookie exist “BIGipServerhalifax”] } {
pool halifax
incr ::total_active_clients
log “Total Clients $::total_active_clients”
log "Active Sessions $::active_sessions { } "
} else { if { $::total_active_clients < $::max_active_clients } {
if { [HTTP::uri] contains “linkID=halifax” } {
pool halifax
incr ::total_active_clients
} else { HTTP::redirect “Activate Cookies” }
} else { HTTP::redirect “http://www.yahoo.com/”
return
}
}
}
when CLIENT_CLOSED {
incr ::total_active_clients -1
}
}