Sunday, December 17, 2006

CODE POST: Stresser (Web Application Load Utility)

A couple weeks ago I was presented with the challenge of testing load on a particular web application and I needed a tool to do nothing but generate page requests. I had been playing with various JavaScript libraries such as Prototype, Moo FX, Script.aculo.us and decided I would try to create a basic web application that used AJAX to generate a number of random asynchronous calls to a web application.



I ended up choosing Prototype, and although in the past I had created my own AJAX code, the Prototype library made it surprisingly simply. I looked over the documentation for Prototype and within minutes I had modeled the framework for my stress tool in just a few lines of code.

The rest was just the basics and although not the most elegant code it was functional and the premise behind "Stresser” was simple. You specify a URL that you want to send HTTP requests to and specify what parameters you want passed. I kept the parameters in what I called a "Parameter Bank” and once you specified the interval it would send a new request you could begin generating traffic. To ensure there was some feedback as to whether the result had changed, I used Paul Johnston’s Javascript MD5 implementation to hash the results and output the size.

Always a fan for writing things from the ground up I must admit I was impressed and sold with the easiness of using the Prototype JavaScript Library. I recommend you check it out.

Prototype (http://prototype.conio.net/)

I would also recommend that you check out Script.aculo.us which has some very nice effects (some of which we recently used on the Codeworx Design Site.

Script.aculo.us – (http://script.aculo.us/)

To download the code for Stresser you can visit:

http://www.codeworxdesign.com/bkn/Stresser-SRC.asp

No comments:

Post a Comment