Saturday, February 21, 2009

ASP.Net 3.5 Performance Boost with Pipeline Optimization

Hi Friends,

Now a days we all are building web sites and forums for increase our popularity or revenue through the advertise.

Now what is in our site that cause a user to visit our site and what is the factor that users are ignoring our site to visit often?

The main factor is functionality and user experience. But even if your site have the best user experience but not the speed, user will slowly dislike your site due to the speed.

So here is a suggestion to optimize your performance of ASP.Net sites with optimizing your pipeline of the execution.

There are several ASP.NET default HttpModules which sit in the request pipeline and intercept each and every request.
for Example Following are default Modules.

<httpModules>
  <add name="OutputCache" type="System.Web.Caching.OutputCacheModule" />
  <add name="Session" type="System.Web.SessionState.SessionStateModule" />
  <add name="WindowsAuthentication" 
        type="System.Web.Security.WindowsAuthenticationModule" />
  <add name="FormsAuthentication" 
        type="System.Web.Security.FormsAuthenticationModule" />
  <add name="PassportAuthentication" 
        type="System.Web.Security.PassportAuthenticationModule" />
  <add name="UrlAuthorization" type="System.Web.Security.UrlAuthorizationModule" />
  <add name="FileAuthorization" type="System.Web.Security.FileAuthorizationModule" />
  <add name="ErrorHandlerModule" type="System.Web.Mobile.ErrorHandlerModule, 
                             System.Web.Mobile, Version=1.0.5000.0, 
                             Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</httpModules>


Now if you want To bust site performance you can Remove Unnecessary modules from pipeline in Web.Config.
For Exam
If we are Using only FormAuthentication we can remove  following Modules.

<httpModules>
         <!-- Remove unnecessary Http Modules for faster pipeline -->
         <remove name="WindowsAuthentication" />
         <remove name="PassportAuthentication" />
         <remove name="AnonymousIdentification" />
         <remove name="UrlAuthorization" />
         <remove name="FileAuthorization" />
</httpModules>

Try this and let me know your review on the performance change. Also please suggest your suggestions which can optimize the performance of the ASP.Net site.