Introduction
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.
Background
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.
if (Membership.ValidateUser("SuperUser", "superuserPwd"))
{
authMemory = Application["SuperUser"] as AuthInMemory;
if (authMemory != null)
{
Session["AUTHCOMPONENT"] = authMemory.AuthComponent;
bool hasRights = authMemory.AuthComponent.HasEntityAccess
("LoginPage", Rights.Read);
if(hasRights)
Response.Redirect("~/public/home.aspx");
Else
labelMessage.Text = "can't log-in!";
}
}
else
{
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:
- # Bytes in all Heaps
- # Gen 0 Collections
- # Gen 1 Collections
- # Gen 2 Collections
- Gen 0 heap size
- Gen 1 heap size
- Gen 2 heap size
- 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.
Notes
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.
History
- 2nd December, 2010: Initial post