Forum Discussion
Jesse_Anderson1
Nimbostratus
Sep 12, 2009Throttling sessions based on JSESSIONID
As a temp fix to an issue we are having, we are thinking of keeping track of sessions into our application on the F5 by tracking the assigned JSESSIONID that the application assigns the users. Based on some examples that I found, this is what I have come up with: ePAS has reached the maximum number of sessions. Please try again later. Message Source: Load Test - SDLCLBSSL
when RULE_INIT {
set ::total_active_clients 0
set ::max_active_clients 1
set session_error {
EPAS: Max Number of Sessions
}
log local0. "rule session_limit initialized: total/max: $::total_active_clients/$::max_active_clients"
}
when HTTP_RESPONSE {
if {[HTTP::cookie "JSESSIONID"] != ""}{
if {$::total_active_clients < $::max_active_clients}{
incr ::total_active_clients +1
log local0. "under session total/max: $::total_active_clients/$::max_active_clients"
} else {
if { [HTTP::status] == 200 } {
HTTP::respond 503 [subst $::session_error]
log local0. "over session session: total/max: $::total_active_clients/$::max_active_clients"
}
}
}
}
But I can't get this to work right. It's my first serious iRule that I'm trying to write and could use some tips or a point in the right direction. Right now I just want to make sure that the HTTP_RESPONSE has a JSESSIONID and once the limit is reached then send all other requests the HTTP::RESPOND that I set up as a 503 even if they are succesful to login to the application. This way if the max JSESSIONID is reached they don't get into the application, but it allows all original HTTP requests to go in and not throttle on the request.
Thanks for the help.
- The_Bhattman
Nimbostratus
Your irule is not correctly tracking the active sessions or connection (connections and disconnections) - Jesse_Anderson1
Nimbostratus
Thanks so much. I think this helps out a lot. I didn't have an array set up, just trying to count HTTP responses with the JSESSIONID cookie. I think I may have a better grasp on this now, just have to redo it a little bit.
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