Load Testing WCF Services using Visual Studio – Part 2

Share on facebook
Share on twitter
Share on linkedin


This is a two-part series that covers using Visual Studio to load test a WCF service. In Part 1 of this series we covered how to create a project and unit tests. Part 2 covers creating and executing the load test.

Creating the Load Tests


Now that I have unit tests created (from Part 1), I will create and configure a load test. I added a load test to the solution and configured it using the wizard. There are several screens the wizard walks you through; in the interest of keeping this short, I’m only including a couple screen shots.  

Figure 4 – Load Test Wizard – Configuring the load pattern

The next figure illustrates how references to the unit tests are added to the Load. There is a great deal of flexibility for specifying how unit tests are distributed. This allows me to closely match the expected operating conditions whereby a given service may have a different load than another.


Figure 5 – Load Test Wizard – Configuring the test mix

Figure 5 shows how Solution Explorer looks once all the project items have been added.


Figure 6 – Solution Explorer containing unit tests and load tests

Running the Load Tests

With all the prerequisite work out of the way, I am now ready to begin executing the load tests. Once I open the load test in Solution Explorer I can change any settings to suit my needs or just click Run Load Test from the menu.


Figure 7 – Running the load test

As the load test runs, the results are displayed near real-time. Several graphs are drawn giving you valuable insight into what is happening.

Analyzing Results

Figure 7 shows the results of an actual WCF load test execution. This test was short, only 3 minutes where the user load was stepped up every few seconds. A good deal of valuable information was learned from this:

  • The Tests/Sec leveled off around 30 seconds into the test; even though the test gradually increased the number of users, the throughput never increased after that.
  • The Average test time increased in proportion to the user load.
  • At 2:30 the error rate climbed steeply.

Figure 8 – Load test results graph

Graphs like the one above will help in determining what types of performance tuning might be necessary. The information derived from the load test can help answer if the service architecture is acceptable or if the hardware would need to be a higher caliber and/or scaled out.  Regular execution of the load test over the duration of the development cycle provides clues into any inefficient code that might be added.


This article showed how to create unit tests that can be used to run load tests in Visual Studio. With minimal writing of code paired with the load testing capabilities available in Visual Studio, you can provide valuable insight into the design and performance of the WCF solution. This information will aid in determining if the solution performance will be within acceptable limits.

Part 1 – Load Testing a WCF service using Visual Studio

More to explore