Check .NET Application Performance Using Performance Optimization

Introduction

Performance optimization is very subjective and it depends upon multiple factors like application architecture, design and way of their implementation (coding). Before taking any action, first need to check area of improvements and only then change can be done based upon their requirement. That’s why I decided to explain this topic in series.

Before start performance check for any application, need to understand some basic requirements. It always depends on business requirement that what is client benchmark, it is called NFR (Non Functional Requirement) requirements. There can be scenarios where client is saying “application performance is very poor” which itself a huge statement and as developer they can’t easily understand that. Because as developer they want some figures like what is current load that application can handle and what is expected load that client want to meet. Based upon that measurements they can start work and take actions appropriately.

Background

Now question comes, how to check current load of exiting application which I will explain step by step.

Application performance can be measured based upon the following four factors.

  • Response time: Time duration between users send request and system display response means time difference between HTTPRequest send and HTTPResponse received at client end.

  • Throughput: Total number of request that a server can handle per second. E.g. 1000 transaction can handle per second.

  • Resource Utilization: Resource utilization cost calculated based upon server and Network resources. Resources that consume during request processing are:

    • CPU
    • Memory
    • Disk I/O
    • Network I/O

  • Workload: How much user load that application can handle on server. There can be two types of user load simultaneous users or concurrent users.

    • Simultaneous users: Have active connections to the same Web site.
    • Concurrent users: Hit the site at exactly the same moment.

To check this practically, I used Visual Studio Performance Test against my application and verify the results as it is easy for any .NET developer. You can use any other tool like Load Runner, jMiter, etc.

Create Performance Test

Firstly, I will explain how to check performance for web based applications step by step.

Step 1: Copy web site URL that need to be tested and that can be your local machine url e.g.http://localhost:16260/Account/Login. Note down all the steps and input data that need to capture during performance test.

Step 2: Open Visual Studio and create new project of type Web Performance and Load Test Project as in the following: 

Web Performance and Load Test

Step 3: Open .webtest file and select Add Recording. Same can be done on right click webtest file and select Add Recording.

Add Recording

It will open Internet Explorer and there will be recording toolbar on left hand side.

Record

Step 4: Click Record button and paste required URL in browser and run web application and execute required functionality. It will start recording all HTTPRequest and HTTPResponse details including dynamic data (input fields). After recoding completion you will see Web performance test in the Web Performance Test Editor as a list of URLs. Here editing can be done.

Web performance

Edit Performance Test

Step 1: Open .webtest file and there will be list of requested URL (called request tree).

Step 2: Select any URL and check their properties (as shown in above image). It shows properties related to HTTPRequest and HTTPResponse. Notice that Think Time for this request is a number greater than 0. This is how many seconds you take before sending second request. Means you send first request at 01:01:10 and second request at 01:01:20 then its value will be 10 seconds. In above image, you can see it request for login page and after successful authentication it route to “Admin/Default.aspx”.

Step 3: To change Think Time value, click Set Request Details and it will open window for request and set values 1 or whatever you want to put as per your requirement.

Set Request Details

Here you can set the following values:

  • Reporting names: Reporting names make it easier to identify specific Web requests in the Web Performance Test Results Viewer and when you create Excel reports.

  • Think times: Artificial human delay times between Web requests.

  • Response time goals: Seconds you want to set as a goal for the response time on a Web request. This is very important to you want to check whether your page process successfully or not in specified time duration.

Step 4: Select any URL and expand Form Post Parameters. Here you can provide requested parameter that you want to provide and also URL Expected HTTP Status Code property value. Like if you think there should be exception from server side based upon particular parameter then provide server response to 500 or any other HTTP Response value.

Apart from that you can also specify Validation and Extraction rules like Web application is working correctly by validating that text, tags, or attributes exist on the page that is returned by a Web request. But that is not our scope as we need to concentrate only on application performance not application functionality validation.

Next when test run it will use these performance parameters to all web requests.

Run and analyze test results

Step 1: Web Performance Test Editor, choose Run Test (as shown in above image) on the toolbar. Here you will see progress all the web requests that you have done during recordings with updated parameter settings.

Step 2: In Test Results Viewer window, If it is green then all things gone fine and as per your expected results and if it red then there is some issue with result and it fails your result expectations.

Test Results

Step 3: Now change Response Goal more realistic value and see where your page able to achieve that target or not. Here we set Response Goal to 1 sec.

change Response Goal

Step 4: Run the performance test again and see the results. Here you will see it failed and to see error details, Select test case in Test Results Viewer window and right click then select View Test Results Details. Here you can see detail description about error like where exactly issue occur and what the reason is for the same.

View Test Results Details

In this article, you learned how you can check performance for any web page. You can create multiple Web Performance test cases for different module like Customer, Admin and Manager Roles. Because during load test there will be different requirement for each type of module e.g. for eCommerce site Customer load will be more than Admin and Manager. So performance for modules which are mostly used by end user like Item Search, Add to Card, Checkout should be more target.

In my next article,  will explain how this web performance test will behave under heavy load. There you can also see server resources consumption done by your application.
 

Up Next
    Ebook Download
    View all
    Learn
    View all