Forum Discussion
Michael_Farnan_
Nimbostratus
May 25, 2007DataGroup with > operator for connection limit
I am trying to limit the number of connections coming in, with 2 limits. One for projects that will be busy, and 1 for everything else.
The problem i've run into, is i'd like to be able to use Datagroups instead of the variables at the RULE_INIT but I can not seem to get the comparison to work when I switch it to use the integer data group.
This would allow us to adjust the maximums on the fly. With it in the RULE_INIT section, any time you adjust those numbers, it resets the activeConnections which means we lose track of all the connections we currently have.
when RULE_INIT {
This holds the number of currently active connections.
set ::activeConnections 0
This is the maximum number of connections allowed for high volume projects.
set ::maximumHighVolumeConnections 4
This is the maximum connections allowed for the entire datacenter.
set ::maximumConnections 6
}
if we have too many connections respond with an error page stating we're too busy.
if {$::activeConnections > $::maximumConnections}
{
log local0. "Maximum sessions exceeded active sessions is $::activeConnections max sessions is $::maximumConnections"
HTTP::respond 200 content "We are currently experiencing extermely high volume please try back later."
}
elseif { ($::activeConnections > $::maximumHighVolumeConnections) and [matchclass [HTTP::path] starts_with $::HighVolumeProjects]}
{
if we have too many connections from high volume projects respond with an error page stating we're too busy.
log local0. "High Volume Client Not Allowed active sessions is $::activeConnections max sessions is $::maximumHighVolumeConnections'"
HTTP::respond 200 content "We are currently experiencing high volume please try back later."
}
- Michael_Farnan_
Nimbostratus
Additionaly i'm wondering if you can use the respond command to point to an actual html page stored on the LTM. - hoolio
Cirrostratus
Can you post the example you're working on using datagroups? Can you add a log statement to see what string you're getting from the datagroup when trying to perform the comparison? - Michael_Farnan_
Nimbostratus
- Michael_Farnan_
Nimbostratus
I was able to fix this using lindex (classname) (index) - hoolio
Cirrostratus
Perfect. As you found, a datagroup is just a TCL list. So to reference the list item, you can specify the index of the element.
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