Serializing Web Service Requests to run Load Tests
August 23, 2009
A few days ago we wanted to how would our application behave under high stress scenarios and wanted to take as little time as possible. We thought we would be able to use Microsoft Web Stress tool. But it turned out that the tool location is not available anymore on the Microsoft web site. We tried an older version, but it seemed that it was not a proper tool to run load tests. We have a custom Sharepoint application running in front of an application server. All of the core business logic goes through the application server. The web application calls the application server via a few web service calls. This is how the application is supposed to be deployed.
Since all the core requests are coming from web to the app via web services, and our goal was to to stress test the application server, we could simulate stress by calling the web service in the application server.
Issues
The first and basic issue is, that we had very limited time and in that time it was not possible write real life test scenarios for most of the use cases.
The second issue was, the test should be as realistic as possible. Writing tests may not be best way.
Solution
The solution was to record a real use case, and then play it again many times with a little varied parameters.
Implementation
So we injected a little code in the web service (we could do this with context handlers, but we did not have the time). Serialized each of the web requests sequentially, In the start of a use case we would clear the folder where we were serializing the web requests. After we have finished the use case then we would de-serialize the requests and inject some randomizing items to a few parameters that changes in real life and then run in multiple thread to simulate real stress. The diagram below shows the whole process. The process if repeated in multiple threads to simulate multiple clients and it worked.
So if any of you want to simulate real life scenario without writing too much code, give this a try. Will update this blog with sample code a few days later.
One easy way to quickly write load test scripts is to record actions using Fiddler and Fiddler can generate VS WebTest from it. Then you can run those VS WebTests in a load test. No coding required.
Posted by: Omar | September 19, 2009 at 12:18 PM
Nice idea..............
Posted by: RP | October 17, 2009 at 07:15 PM