04 August, 2013

Performance - Scaling Strategies for ASP.NET Applications


expert .net developers
A good number of the websites which draw a large amount of traffic run on ASP.NET. Performance problems might occur as the application scales up, and in that case, it is imperative to determine the inherent strategies required to address the same. The greatest challenge lies in the creation of a group of measurements that would be able to cover your application’s performance from end to end. You need to understand the problem as a whole, in order to find out the focus areas.

The Performance Equation

For measurement of web application performance, the following equation is used:

R~Payload/Bandwidth + AppTurns (RTT)/Concurrent Requests + RTT + Cc + Cs

The definition of each of the above mentioned variables lies as follows:
  • R refers to response time. It is the time gap between the user request for a page and the opening of the full page on the computer.
  • Payload indicates the sum total of the bytes sent to the browser.
  • Bandwidth refers to the transfer rate from and to the browser.
  • AppTurns measures a given page’s resource file number, including images, JS, CSS and others.
  • RTT represents the time for round-trip, irrespective of number of bytes transferred.
  • Concurrent Requests is the number of requests that a browser can simultaneously make for the resource files.
  • Cc refers to the client compute time.
  • Cs is the server compute time.
The main challenge lies in the measurement of each element. There are a number of tools for measurement of Response time, Payload, Bandwidth and Round Trip Time. Moreover, there are tools for reporting the magnitude of a web page’s CSS, HTML, JavaScript and so on. Concurrent Request is basically a constant while some extra development effort is required for Cc and Cs.

Coding can be done for all these elements in case you wish to develop your website in a debug mode that leverages the performance equation. Once the elements of the performance equation can be routinely rendered on the browser, convenient detection of performance problem areas is possible.

Dealing with Scaling Issues

For improvement of scaling there are three strategies that can be employed:
  • Specialization: The aim of this strategy is to break the application into smaller components for isolation of the problem. For instance, one might try moving CSS, JS, images or other such static resource files off ASP.Net servers. Specialization should only be carried out when the benefit is known.
  • Optimization: Optimizing the server code can ensure effective scaling. Linear scaling is applicable for all aspects of the performance equation except for the server compute time. The crux of optimizing server code lies in the fact that testing is used for ensuring that an actual difference is being made. Profiling tools should be used for analyzing the application and finding out the area where most of the time is being spent. The whole process needs to be empirical- leverage tools for finding the code that requires enhancement, enhance the code, verify whether the performance has actually improved, rinse, lather and repeat the process.
  • Distribution: For implementation of distribution, servers need to be added, the apps duplicated across the servers and load balancing done. NLB (Network Load Balancing) can be utilized for load balancing which makes all the servers equal partners in the load balancing association. For effective distribution, you need to do away with affinity. For instance, when there is a single web server, it is good to store session data there. However, if there are two or more web servers, you need to think differently. One strategy is to store it on the web server and utilize affinity. This implies that a given user’s first request is load balanced while all the subsequent requests from the same user or session go to the same server as the first one.
Minimizing Payload
A glance at the performance equation will tell you that the payload pays an important role, especially while it is a case of limited bandwidth. Decrease in the size of the payload will enhance the response time and it will also give you certain scaling benefits as well as cut down on the bandwidth costs.

Caching
Data is moved closer to the user through caching. Basically, in any ASP.Net application, prior to any substantial optimization work, virtually all the required data lies in the database and with every request; the same is retrieved from the database. ASP.Net renders support to three types of caching- programmatic or data caching, page caching and partial-page caching.

Scaling Databases
Scaling out is usually done for websites rather than scaling up. But when it is the question of scaling databases, scaling up is the normal approach. Specialization is definitely the first step, which involves breaking the database into logical components or partitions. These are data centric partitions which lead to manifold databases, each comprising a segment of the entire database.

During the entire growth phase of the application, the scaling effort also records continuous growth. The key to efficient scaling is to go for measurement before cutting, which means that you should do proper verification to ensure that an improvement is being made rather than a change. While selecting .Net development services India providers, choose one which has proper experience in handling .Net projects.

We provide asp.net application development services. If you would like to hire dot net programmers from our team, please get in touch with us at Mindfire Solutions.

No comments: