UNLEARN
  • Blog
  • Contact

OPTIMIZING ASP.NET MVC APPLICATION

5/31/2016

0 Comments

 
Picture
When looking at the performance of any client-server application, we must take a look at it from various perspectives. One must follow proper guidelines and processes in order to analyze, debug, and implement the performance tricks into their web application. It is very crucial to have a good understanding of the entire application architectures and business rules before proceeding to the performance implementation of a system. In this articles, I am going to talk about some very distinct ways to improve the performance of the ASP.NET MVC application. Developers often overlook these options while developing the application.
Performance Analysis
How do you know whether the application you have built is running below the performance criteria line? When do you want to really think about the performance? Keep in mind that some application processes cannot be reduced below certain numbers. This is alright as long as it is not creating any performance bottlenecks in the system. But if your instinct tells you that certain pages of your web application need to be optimized, then you should start exploring the techniques to boost up the performance level. The analysis and implementation of performance can be divided into four parts.
  •   Database Level: SQL
  •   Model and Data Access :Repositories Classes
  •   Controller Level: Loops, algorithm selection
  •   UI Level: HTML, DOM Parsing, Minification and Bundling 
Regardless of whether there is a problem in model, view, controller, or even at the database side, the overall performance of the application can be measured using the following techniques. There are other sophisticated tools and tricks that will help you to get deep into the analysis of the performance of a web application; however, a pragmatic analysis can be done simply by pressing F12 on your browser and looking at the network and transport level communication while you application is running. 
All the browsers come with a debugger tools that can be utilized to look at various things. Press F12 on your browser (While the app is running) to get to these tools. Google chrome debugger /Firebug by Firefox are excellent tools for tracking the network traffic activities.
  • Testing with Network Activity monitor: To capture raw data load time (Eg JS, CSS, and Image Files etc.)
  • Load testing using jMeter: To capture load performance 
  • Memory Testing using Mock Data: To capture Memory Usage and Algorithm Analysis 
Performance Enhancement
Enhancing performance is no joke. First of all, you should start looking at problems that are causing heavy performance bottlenecks.
For example, 
Look at the network traffic to analyze how much time(Percentage wise) is taken for each http requests.

Database Optimization
  •  Normalization(De coupling tables) vs De-normalization(Less table traversing)
  • Indexes (Clustered and non-clustered Index)
  • Writing Stored procedures or RAW SQL
  • SQL Profiler for performance Analysis 
C# Code Optimization
  • Lazy vs Eager Loading
  • Dataload options/Include/Include Properties
  • Standard vs Compiled Queries
  • Caching Techniques(Output cache, data cache on Client and Server)
  • Right Algorithm selector (Appropriate Collection items , Loops, Recursion, tree, graph  )
  • IQueryable vs IEnumerable 
  • AsIEnureable and AsIQueryable on LINQ Queries
  • Clean Repositories and Unit of Work operations
  • Using strict ViewModels that carries minimum data
UI Optimization 
  • Use Bundling and minification 
  • Absolutely Less HTML/CSS(Shorter Class/ID name, use name color vs hex, fewer graphics, comments, and whitespaces, do not include static HTML that is not needed in the first place)
  • DOM Traversing using JS(DOM is like a tree use Id selector, user descendent selector, use tag name vs attributes, use jquery Chaining)
  • Caching element(Object) and keep it in memory
  • Avoid using JS/CSS Libraries that are not necessary for the pages and avoid duplicate css and js files
  • Fewer HTTP Requests means fewer trips
  • Avoid large data load (Use partial loading and paging techniques)
  • User AJAX Tricks to load data before user gets to the view
0 Comments



Leave a Reply.

    Picture

    Sudeep Devkota

     A software Engineer, trying to teach other to become one. 

    FOLLOW ME ON

    Archives

    June 2017
    May 2016
    March 2016
    February 2016
    June 2015
    May 2015

    RSS Feed

Powered by Create your own unique website with customizable templates.
  • Blog
  • Contact