Investigating performance bottlenecks in your web application - Part 2

In the previous post we talked about the performance tuning of the application by finding the bottlenecks in the code and modifying them to get a better response time. However, the code is not the only factor in performance tuning process. In this post I will list the other parameters that will affect the overall response time of the web requests.

application Release mode vs Debug mode

Make sure the assemblies are compiled in release mode. Debug and Release are different configurations for building your project. As the name implies, you generally use the Debug mode for debugging your project, and the Release mode for the final build for end users. The Debug mode does not optimize the binary it produces (as optimizations can greatly complicate debugging), and generates additional data to aid debugging. The Release mode enables optimizations and generates less (or no) extra debug data.

You should also make sure to set the debug mode to false in web.config:



 



IIS request pipeline mode
if you are using IIS 7+ to host the application it is highly recommended to have a separate application pool assigned to the web application and set the pipeline mode to Integrated with target .Net framework 4.0. IIS7+ supports both classic and integrated modes. Classic mode follows the request pipeline structure as in IIS6. Integrated mode follows the IIS7 new pipeline structure witch is completely different. The following articles will help you to understand the differences and features of each mode:

How to Take Advantage of the IIS 7.0 Integrated Pipeline
ASP.NET Thread Usage on IIS 7.0 and 6.0

If your application is now working in classic mode then you need to make some changes in config file to support integrated mode. The easiest way is using IIS appcmd command. In command prompt window type the following command :
%SystemRoot%\system32\inetsrv\appcmd migrate config "SiteName/"

[SiteName] is the name of your web site. This command will change the web.config file in the root of web site. By comparing the old and new config file you will find out that this command puts all your httpHandlers and httpModules in section.

For ASP.NET MVC applications make sure the modules section inside the contains the following parts:


      
      
      
      


machine.config
ASP.NET Process Model configuration defines some process level properties like how many number of threads ASP.NET uses, how long it blocks a thread before timing out, how many requests to keep waiting for IO works to complete and so on. The default is in many cases too limiting. Nowadays hardware has become quite cheap and dual core with gigabyte RAM servers have become a very common choice. So, the process model configuration can be tweaked to make ASP.NET process consume more system resources and provide better scalability from each server.

You can tweak the process model in machine.config file located in the $WINDOWS$\Microsoft.NET\Framework\$VERSION$\CONFIG directory. 10 ASP.NET Performance and Scalability Secrets is one of the best articles on the web that guides you very well.

In the Complete Guide .NET Performance and Optimization , Paul Glavich and Chris Farrell offer a comprehensive and essential handbook to anybody looking to set up a .NET testing environment and get the best results out of it, or just learn effective techniques for testing and optimizing their .NET applications. I strongly recommend this book to every web developer.

6 comments:

  1. Sometime Data enables a developer to evaluate application performance range in the beginning of project in .net performance and to creat code knowing, which mode is the best to use our visual components.
    http://www.dapfor.com/en/net-suite/net-grid/features/performance

    ReplyDelete

  2. Nice post, Thanks for sharing Get more update at
    .Net Online Training Bangalore

    ReplyDelete