Wednesday, November 16, 2005

Stress testing Web Services

If you need to test your Web Service for performance, you can use the Web Application Stress Test (WAST) tool. It's a microsoft tool, free of cost.

You can learn more about how to use it in my paper on optimizing web applications. But that paper only talks about using WAST for web apps, i.e. browser based applications. What about web services?

Let's see how WAST works. When you hit "record", WAST opens a new browser window, where you must access your web page, click links, enter data etc. When you're done, you close the browser, and WAST will then allow you to simulate the same steps with lots more users, bandwidth etc. and gets the results to see how your web app responds to stress.

What WAST does is it acts like a proxy server, and records your requests. It will then "play back" the requests through multiple threads to simulate multiple users.

Web services can be stress tested the same way.

First, ensure you're using WinInet in
your Delphi SOAP and not Indy (WinInet is the default so if you don't know what this is, don't bother) This step is not necessary for .NET based web services of course.

Run WAST, and hit "Record". A browser window will come up. Ignore it, but do NOT close it.

Run your Web Service Client (something that accesses all functions of your web service) in the same machine as your server.

Go through a simulated use case on the client - eg. logon, get something, save something etc.

Close that (ignored) browser window when done.

You'll notice that WAST has done all the recording of XML sent etc. This can then be simulated for lots more users.

Note that WAST will only report on bad web results (Server errors returned as HTTP result codes etc.) You might need a different approach if you need to figure out SOAP Faults as well (maybe a temporary try/catch handler in the server that returns a different HTTP code if there's an exception)

Also if you want to see web requests in general, check out Fiddler.