Click here to Skip to main content
15,881,027 members
Articles / DevOps / Load Testing

Performance Testing of ASP.NET Website

Rate me:
Please Sign up or sign in to vote.
4.60/5 (3 votes)
2 Dec 2010CPOL5 min read 63K   37   4
This article explains performance testing of ASP.NET website using VSTS 2008


This article explains how to do performance testing using Visual Studio Team System 2008.

VSTS provides Load Test Agents and Controller for performance testing of any website. I have created a demo website which has login page and home page. Login page uses third party authentication tool for SSO (Single Sign On). We will test the performance of Login page and memory consumption of SSO tool on the server when multiple concurrent users try to login to the website.


I expect you to know basic terminology like Response time, Latency, Throughput, Load, Load sensitivity and scalability, etc. Please visit here for more information.

Also basic knowledge of Load Test Agent and Controller of VSTS is required. You need to have knowledge of installation and deployment scenario of Agents and Controller. Please refer to this for deployment scenario and this for installation and other stuff.

Using the Code

I have created a simple ASP.NET website using VS2008. It has two pages, Login.aspx and Home.aspx. When a user enters the URL, then login page will be displayed. The user will enter his credentials and submit the login page. This credential will be validated at the server side and an authentic user will be navigated to the home page.

// Validate user
if (Membership.ValidateUser("SuperUser", "superuserPwd"))
     authMemory = Application["SuperUser"] as AuthInMemory;// is token already in memory 
     if (authMemory != null)
         Session["AUTHCOMPONENT"] = authMemory.AuthComponent;

         bool hasRights = authMemory.AuthComponent.HasEntityAccess
				("LoginPage", Rights.Read);

			labelMessage.Text = "can't log-in!";
     labelMessage.Text = "can't log-in!";

Remember one thing, I have used third party SSO tool for login. As you can see in the above code, I store auth component in session. We occupy server memory for this component for all logged in users. So we want to measure the CLR memory consumption of auth token on the server side when large number of concurrent users are logged in and also response time for login page.

I assume that you already have Load Test Agent and Controller on your local machine or different machine depends upon your requirement and deployment scenario. You can also use Virtual Machine or VMWare for this purpose.

So let’s start performance test of our website step by step.

Step 1: First of all, we have to create the WebTest for our website. The purpose of WebTest is to simulate the login scenario. Click ‘Add New Test’. It will display the following dialog box showing multiple types of test. Select Web Test and enter your test name. It has .webteset extension.


It will display Web Test Recorder. Now click on ‘Record’ and start recording login steps.


Complete your test process and stop the recording. WebTest1.webtest will be included in your project.

So now, we will do load test of this recorded webtest.

Step 2: Create Load Test by clicking add new test. It will display the same dialog box as for WebTest. Select Load Test. It has .loadtest extension. It will launch Load Test Wizard to configure our load test.


I will not describe each and every step here because it is out of the scope of this article. Please refer to load test wizard help for more information. I have setup a load test for 1000 start up users and increase 100 users load per second. Maximum users will be 10000.


In the Test Mix, add your webtest which you created in the previous step.


Most important is selection of your performance counters in Counter Sets. You can select counters based on your requirement. I have selected the following counters.


Finish the wizard after completing all steps. Now, right click on ‘Run setting’ node and click ‘Run Test’. It will start the load testing as per your configuration and the result will start to come.



You can add new graph and counters as per your requirement.

Now, we want to measure memory consumption on the server and response time for login page. We want to see memory consumption on server because we want to see memory threshold, that is at what user load server touches highest memory usage and at what user load server will crash due to not enough memory, so that we can plan scale up/scale down the server. We need to take .NET CLR memory counter to measure ASP.NET website’s memory. You can take the following counters of .NET CLR Memory:

  1. # Bytes in all Heaps
  2. # Gen 0 Collections
  3. # Gen 1 Collections
  4. # Gen 2 Collections
  5. Gen 0 heap size
  6. Gen 1 heap size
  7. Gen 2 heap size
  8. Large Object Heap size

You can also take Available Mbytes and User Load in different graphs just to make sure that your .NET CLR Memory consumption is in line with overall available memory with increasing user loads. Please see detailed information on each counter here.

Now, to measure login page performance, we can take ‘Avg. Response Time’ and ‘Page Response Time’. Avg Response Time shows the response time for webrequest whereas Page Response time includes time to load all dependent requests such as images and stylesheet loading, etc. that are included with the web page.

So Avg Response Time is more like processing time on server with latency time. Page Response time includes everything. So this is the simple performance test I explain to you. However there are many things which you need to consider for detailed testing like cache memory, memory leaks, etc.


You need to be very careful while selecting performance counter. You have to select appropriate instance when you select counter. Do not take ‘_Global_’ instance because it will not show you the right result. You have to select instance of your application.


  • 2nd December, 2010: Initial post


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Comments and Discussions

GeneralMy vote of 5 Pin
mdsajidfaizan26-Sep-13 2:22
professionalmdsajidfaizan26-Sep-13 2:22 
No Words...
GeneralVS 2008 Ultimate only Pin
Xmen Real 3-Dec-10 2:15
professional Xmen Real 3-Dec-10 2:15 
GeneralRe: VS 2008 Ultimate only Pin
Ravi Karia3-Dec-10 3:19
Ravi Karia3-Dec-10 3:19 
GeneralMy vote of 5 Pin
thatraja3-Dec-10 1:27
professionalthatraja3-Dec-10 1:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.