Forum Discussion
hooleylist
Aug 01, 2014Cirrostratus
You can save a bit of CPU cycles by not doing the data group lookups on each HTTP request. You could do this once at config load time by moving the lookups to RULE_INIT:
when RULE_INIT {
set static::maxActiveClients "[class search -all -value datagroup_selfridges_waitingroom starts_with "max_active_clients"]"
set static::subtableName "sessionLimit"
set static::sessionCookieName "[class search -all -value datagroup_selfridges_waitingroom starts_with "session_cookie_prefix"]"
set static::holdingPage "[class search -all -value datagroup_selfridges_waitingroom starts_with "holding_page_url"]"
set static::sessionTimeout "[class search -all -value datagroup_selfridges_waitingroom starts_with "session_timeout"]"
}
If you want some/all of these lookups done more frequently, you could move them to the CLIENT_ACCEPTED event instead. Maybe the timeout and max_active_clients?
You can check if the cookie value isn't null in one step like this:
Current:
if {[HTTP::cookie exists $sessionCookieName]}{
set client_id [HTTP::cookie $sessionCookieName]`
Suggested:
if {[set client_id [HTTP::cookie $sessionCookieName]] ne ""}{
You can save a bit of CPU by using ne instead of != for text comparisons:
Current:
if { $sessiondata != "" } {
Suggested:
if { $sessiondata ne "" } {
Aaron