Version
4.0
2.3 Reconfiguring your site based on
Traffic Load
In this example, we'll monitor the performance of the JSP pages on a
website. If the performance drops below an acceptable level, we'll use
the Control API to enable a TrafficScript rule that prevents more users
from logging into the website. Once performance climbs back to an
acceptable level, the Control API application can disable the rule.
The TrafficScript Rule
To prevent users from logging into the site, we could use a TrafficScript
rule similar to the following:
$path = http.getPath();
if( string.endsWith( $path, "login.jsp" ) ) {
http.redirect( "/content/login_disabled.html" );
}
Add this rule to the Rules catalog, calling it `Disable Login'. Configure it
as a request rule for your virtual server, but set it to be disabled. The
ZXTM Control API application will use the Virtual Server getRules() and
setRules() functions to modify the `enabled' status of the rule.
Monitoring Performance
Performance of the web application can be monitored in a variety of
ways:
Using statistics gathered from the web application itself.
Using an external monitoring tool to send probe requests.
Monitoring the node response times using SNMP and ZXTM's Service
Level Monitoring capability.
Using the SNMP or email alerts raised by ZXTM's Service Level
Monitoring capability to drive the Control API applications directly.
Enabling and Disabling the Rule
The following Control API code retrieves the list of response rules that
the named virtual server is using. It searches for the rule named
`Disable Login' and enables it. If the rule is not present, it adds it as the
first rule to be executed.
39
New Page 1