One of my duties as a Channel System Engineer is to update our partners on our new technologies and products. In the recent months after people heard that we acquired two new outstanding technologies, I was often asked why believe that the Zeus ADC now Stingray Traffic Manager is superior to other ADCs on the market.
Of course there are many different correct answers to this question. But for me one of the main reasons is its flexibility, scalability and of course the fact that it is highly customizable, making it a solution that is easy to adapt to all the customer scenarios out there.
For those who might have missed it: Stingray Traffic Manager is a high-availability, application-centric traffic management and load balancing virtual ADC. It provides control, intelligence, security and resilience for all application traffic. Stingray Traffic Manager is intended for organizations hosting valuable business-critical services, such as TCP and UDP-based services like HTTP (web) and media delivery, and XML-based services such as Web Services.
Stingray Traffic Manager’s architecture ensures it can handle large volumes of network traffic efficiently. Its scalability allows you to add more front-end traffic managers or back-end servers as the need arises. The cluster size is unlimited, and the performance of the traffic manager grows in line with the performance of the underlying hardware.
These are all amazing features Stingray TM provides for scalabilty and felxibilty, but today I would like to talk specifically about one of the capabilities of the Stingray Traffic Manager that extends the possibilities mentioned above and makes it highly adaptable beyond what would be achievable with a monolithic approach: TrafficScript.
Using the TrafficScript language you can write tailored traffic management rules to inspect, manage and route requests and responses in every imaginable way.
TrafficScript rules can be executed whenever a new connection or network request is received, and whenever it receives a response from a node. The rules you create inspect the incoming and outgoing data in the connection, and other aspects such as e.g. the remote client address, destination address and port. You can write rules that can then modify the request or response (for example, rewriting the URL or headers in an HTTP request), set session persistence parameters, or decide how to route the request or even rewrite the content of the output page.

There are many occasions when you might want to use a TrafficScript rule.:
- You can use a rule to dictate session persistence information
- Rules can be used to check the response from the server and modify it, or even retry the request (if possible) if a transient error was detected.
- If you use various back-end systems with different presentation styles or even different protocols, rules can be used to integrate them into a single, coherent and consistent service. Incoming requests can be rewritten into the format suitable for the required service, and responses can be rewritten into a single, consistent form. For example, HTTP requests that involve a database lookup can be rewritten into SOAP request for a Web Service; the XML response can then be transformed into a suitable HTML document to return via HTTP.
- Rules can specify custom behavior for each connection; e.g. connections to a slow resource can be given a longer response time tolerance for example.
- Security: You can use a rule to check packets for a match with known web worms or viruses.
- Data Protection: you can write rules that ensure that sensitive data like credit card numbers or social security numbers are automatically hidden even if they were to be displayed in the output of a web page by accident.
One of the great properties of TrafficScript is that it is easy to learn and understand! Even for people with little coding experience. You don’t have to worry about having to learn an entirely new, complicated scripting language, TrafficScript will look familiar even to the untrained eye.
Here are two examples of TrafficScript rules:
1) Restricting Access Based on the Time of Day
This example only allows access to a particular service during office hours (between 9am and 6pm, Monday to Friday). It discards all connections that occur outside these times.
$dayofweek = sys.time.weekDay();
$hourofday = sys.time.hour();
# $dayofweek: Sunday is 1, Saturday is 7
# $hourofday: office hours are between 9am and 5:59pm if( $dayofweek == 1 ||
$dayofweek == 7 ||
$hourofday < 9 ||
$hourofday >= 18 ) {
log.warn( "Warning: access out of hours!" );
connection.discard();
}
2) Customer Prioritization
This example inspects the cookie in an HTTP request. It uses the value of the cookie to determine which pool to direct the request to. One pool is faster than the other because it contains machines that are reserved for premium users.
A company has a customer base divided into “gold” and “silver” membership. It wishes to give priority to the “gold” customers and has five servers, yellow, green, blue, black and purple.
Two server pools are created: standard, for the “silver” customers, containing machines yellow, green and blue; and premium, for the “gold” customers, which includes all five of the servers. Thus black and purple are only available to the “gold” customers.

The site uses a cookie login system, with the customer type encoded in the cookie. Different membership levels can be detected, and sent to the correct pool. This is the script needed to achieve this:
$cookie = http.getHeader( "cookie" );
if( string.contains( $cookie, "gold" )) {
pool.use( "premium" );
} else {
pool.use( "standard" );
}
5 short lines of code to ensure that your premium customers get the best possible service!
These two short examples show that TrafficScript is indeed a very approachable, easy to learn scripting language. The best part is: our outstanding Support Team will assist you if you have problems writing or adaptig your own TrafficScripts.
This is part of your support contract and ensures that there is someone around to help you at all times at no extra cost.
For a detailed overview and syntax to get you started, take a look at our Stingray Traffic Manager TrafficScript Guide.
Of course there is also a community of TrafficScript Users that can help you with your first (and further) steps. Visit them at http://community.riverbed.com/t5/Stingray-Family/ct-p/zeusproducts for code samples, answers to your questions and further documentation.