SLM Class TrafficScript Examples

The following examples illustrate how a default SLM class can be overridden for certain types of requests, and how to use the performance of one SLM class to control how you manage traffic.

"FrontPage™ Scripts Only" Service Level Monitoring

Microsoft FrontPage™ upload scripts can take a long time to run, particularly when the client is uploading content from a slow connection. This can even lead to a pool being marked as failed, even though there is no malfunction.

To distinguish between response times for normal content, and response times for FrontPage binaries, we can use a TrafficScript rule that detects FrontPage requests (located in _vti_bin).

$path = http.getPath();

 

if( string.StartsWith( $path, "/vti_bin" ) ) {

   connection.setServiceLevelClass( "FrontPage" );

} else {

   connection.setServiceLevelClass( "Regular" );

}

The FrontPage SLM class should allow considerably higher response times than the Regular class used for all other requests managed by the virtual server.

Prioritizing Resources with Service Level Monitoring

This example tags premium customers with a “premium” service level monitoring class, and directs them to the “premium” pool.

Non-premium customers can share the premium pool if the premium SLM class is functioning within its tolerance, but are directed to the “standard” pool if the premium SLM class is running too slowly.

if( $IsPremium ) {

   connection.setServiceLevelClass( "premium" );

   pool.use( "premium" );

} else {

   if( slm.conforming( "premium" ) == 100 ) {

      pool.use( "premium" );

   } else {

      pool.use( "standard" );

   }

}

pool.use() ends the TrafficScript rule immediately and sends the request to the specified pool.