ASP.NET 2.0 Performance Tuning Considerations

ASP.NET 2.0 has started picking up the momentum and alredy there are a large scale of companies using it for developing cutting edge web applications.

While the features, enhancements have been very good, the decisive factor in web applications development is performance.

ASP.NET 2.0 in general has a lot of performance enhancement feature starting from compilation model to ADO.NET 2.0 DataSets which is comparitively faster than its predecessor. Please check
New DataSet Features in ADO.NET 2.0 for more information.

Herebelow are some of the performance considerations I have observed after digging dirty with performance tuning ASP.NET 2.0 Applications.

Paging through Records
Always use Custom Paging and dont rely on the default built-in paging mechanism for GridView, DataGrid etc.,

Please check my earlier articles on custom paging

Using Cache / Session Objects

Using SQL Server

Turn off Session State
ASP.NET uses a built-in session state mechanism as well as supports your Custom Session State model. However, the cost of Session storage becomes heavy when the users, objects stored increase significantly. Turn off Session State for pages which dont require Session. Typically in a web application there may be static as well as dynamic pages. In the static pages, which dont require Session, the Session State can be turned off. Wherever, you just require Session Data as ReadOnly (where you wont be updating the Session Data), the SessionState can be made ReadOnly.

To turn off Session State at page level,

<%@ Page EnableSessionState="False" %>

To make it ReadOnly at page level,

<%@ Page EnableSessionState="ReadOnly" %>

If your Website has a lot of content pages which are static and only certain pages require Session Data, try considering Turning off SessionState at the Web.Config level and only enable it for those pages which require Session Data. Always the Page settings will override the web.config settings. Session State can be turned off in the web.config as follows:-

<pages enableSessionState="false"></pages>

Turn off View State
View State is the wonderful mechanism which stores the page as well as controls' data, state etc., across round trips. However, the View State can grow heavy significantly increasing the load and hence, View State must be turned off for pages which dont require the same. ViewState can be turned off at page level as follows:-


<%@ Page EnableViewState="False" %>


Use Caching
Cache your pages wherever possible. When implementing OutputCache, set a longer duration than setting a shorter duration. A longer duration Cache is much more better than quick short duration caches.

When the content of page can change, try using Cache with Dependency. There are various dependency techniques such as FileDependency, Database Dependency etc., to invalidate the cache.

Use IsPostBack
The IsPostBack is your best friend in controlling when to load the controls, populate data. ASP.NET, by default postbacks to the server for any/all operations and the number of Page_Loads you would be having will be significant. When using IsPostBack, it validates that the DataBinding methods are called only the first time the page loads and not for subsequent PostBacks.

if(!IsPostBack)
{
// Data Bind your Controls
}

Use DataSources
The Provider model and the DataSource controls in ASP.NET 2.0 not only simplify the Data Binding techniques but also provide significant performance enhancements by caching the Data as well as reducing the number of DB hits required to populate similar data on different controls. The Provider model eliminates the Control from the underlying Data Model thereby making it a thin layer which just represents whatever is bound to it.

When using SqlDataSource, ObjectDataSource etc., an important point to note is that, you dont need to bind the Data explicitly to the controls using DataBind.Ex.-

GridView1.DataSourceId = SqlDataSource1 // where SqlDataSource1 is the ID of the Datasource control.

That is all required. You dont require the GridView1.DataBind(); method which we are very familiar from .NET 1.0. The reason is that, the DataBind method is implicitly called by the EnsureDataBound method of the DataSource control. If we call it explicitly, then it results in a double binding of Data.

There are some other points which I will be covering in the next part of this article.

Please note that some of the points are not specific to ASP.NET 2.0 but do apply for ASP.NET 1.x versions as well. Secondly the performance considerations are mentioned assuming the implementations are done in the proper way with best practices in coding standards etc.,

Cheers and Happy Programming !!!

Print | posted on Friday, August 4, 2006 9:22 AM

Comments on this post

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
Thatz too nice article.
Left by bansh patel on Jun 30, 2008 10:46 PM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
Caching is no.1 choice for improving ASP.NET performance. However, because ASP.NET cache has drawbacks, too , it is not recommended. ASP.NET has data integrity problems in Web Farms, it is a single point of failure, it has cache size limit and more.

The alternative solution is use of third party distributed cache like NCache , which gives you scalable performance of ASP.NET and requires no code change in ASP.NET at all to work
Left by steve on Apr 05, 2010 12:59 AM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
Worth a read and implement...
Keep mosting more..
Left by sanjayeds on Jun 24, 2010 8:47 PM

# Ankara Mezar Bakım Hizmetleri

Requesting Gravatar...
I really liked your site. Design looks very nice. Such a site would like to thank you for bringing us.
Left by mezar-tr on Jul 09, 2010 8:49 PM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
Thanks admin ı like your site
Left by muzik indir on Jul 16, 2010 10:05 AM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
This is good thx
Left by iddaa on Jul 16, 2010 1:45 PM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
<p>Thanks You..My Frıend</p>
Left by BULUT on Jul 27, 2010 8:09 PM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
This is good thx
Left by script on Aug 01, 2010 11:36 PM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
Thanks admin ı like your site
Left by bekir on Aug 02, 2010 2:12 AM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
Thanks for your information about ASP.NET 2.0 Performance Tuning Considerations
Left by alisveriskeyfim.com on Aug 02, 2010 2:32 AM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
This is good thx for.
Left by Oyunyurdum on Aug 02, 2010 6:56 AM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
Thanks admin ı like your site
Left by bekir on Aug 05, 2010 7:23 PM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
thank you very much admin. I like this site
Left by volkan on Aug 05, 2010 7:34 PM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
Thanks admin
Left by chat odaları on Aug 05, 2010 8:08 PM

# ilahiler dinle

Requesting Gravatar...
Güzel paylaşımlar teşekkür ederim
Left by ilahiler on Aug 05, 2010 8:54 PM

# ilahi dinle

Requesting Gravatar...
TEBRİK EDERİM PAYLAŞIMINIZ İÇİN TEŞEKKÜRLER ADMİN
Left by lahi dinle on Aug 05, 2010 8:55 PM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
thank you:)
Left by harika on Aug 09, 2010 6:41 PM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
Thank goodness we found this guide. We are travelling to Shanghai this fall -with our pet - and this provides alot of good

information.
Left by cheap belly button rings on Aug 12, 2010 1:15 PM

# re: indirmeden dizi izle

Requesting Gravatar...
Teşekkürler sizle olmak ve dizi izlemek son sürat zevkli indirmeden izleyin
Left by indirmeden dizi izle on Aug 13, 2010 5:50 PM

# ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
We are also using ASP.NET 2.0 for developing cutting edge web applications and its working more then our expectations.
Left by pimapen on Aug 24, 2010 6:42 AM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
forum paylaş kaynaş
Left by efsanesesli.net on Sep 08, 2010 2:47 AM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
Thanks For Sharing.
Left by Prens on Sep 09, 2010 5:46 PM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
Nice Post ! Thanks...
Left by Kalitelimp4 on Sep 16, 2010 4:38 AM

# Thanks for share. i like this article. :) good post bro ..

Requesting Gravatar...
harbiden müthiş bişey ya :D
Left by tont10 on Sep 17, 2010 7:39 PM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...

Wew..Yes, I am really excited that read these article. I think Cisco in extending the benefits of collaboration with Cisco Intercompany Media Engine across the entire value-chain. Off course The technology admits users to more effectively communicate applying body language through video, as well as optimized voice technology, while at the same time helping to reduce costs.
Left by sinemakurdu on Sep 26, 2010 3:36 AM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
www.onlinesinemaseyret.tk çok teşekkür eder....
Left by serkan on Oct 04, 2010 10:35 PM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
Thanks man...
Left by Red Burn on Oct 05, 2010 11:11 PM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
Nice Post :) Thank you
Left by Emre on Oct 17, 2010 5:42 PM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
thanks for sharing thats good article
Left by kablo tv on Oct 17, 2010 6:11 PM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
thanks for sharing thats good article
Left by iddaa tahminleri on Oct 17, 2010 7:56 PM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
Nice Post :) Thank you
Left by Cabal on Oct 18, 2010 12:58 AM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
thak you very much
Left by dersportali on Oct 18, 2010 1:49 AM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
thanks very good :D
Left by pesedit on Oct 18, 2010 1:50 AM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
This is good thx
Full
Left by fulll download on Oct 18, 2010 2:31 AM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
Thanks admin your site is good
Left by matematik yazılı soruları on Oct 18, 2010 3:53 AM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
this is very nice.thanks for article
Left by adsl tarifeleri on Oct 18, 2010 3:55 AM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
Thank you very much. Very nice site.
Left by abuzerr on Oct 18, 2010 4:13 AM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
this is very nice.thanks for article
Left by haylaz7 on Oct 18, 2010 5:12 AM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
Thanks.Very nice site
Left by PrensinGunlugu on Oct 19, 2010 2:38 AM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
<a href=”http://www.ttnetborcsorgulama.com/” title=”Ttnet Borc Sorgulama”>TTNet Borç Sorgulama
Left by ttnet on Oct 24, 2010 7:59 AM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
Thank you very much. Very nice site. :)
Left by hitfile on Oct 25, 2010 8:21 PM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
thanks, the web ssite is very nice.. thanks admin..
Left by internetgirisimciligi.com on Oct 25, 2010 8:24 PM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
thans admin, your site is good.. very nice site.
Left by internetgirisimciligi.com on Oct 25, 2010 8:26 PM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
Very nice post. I like this for article.
Left by เพลง on Oct 31, 2010 6:34 PM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
Very nice post. I like this for article.
Left by ert on Nov 16, 2010 4:37 PM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
I like this site.

Thanks...
Left by Can Arslan on Nov 19, 2010 2:28 PM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
perfect :)
Left by garaj35 on Nov 20, 2010 7:08 AM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
Vey Good And Perfect : Thanx Admin
Left by Nurettin on Nov 27, 2010 4:15 PM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
Thank you
have a very nice article
Left by semih on Dec 02, 2010 1:44 AM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
It really is a cool project. Thanks.
Left by Asim Usdta on Dec 03, 2010 6:53 PM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
thank you about this project, take it easy
Left by fatih on Dec 05, 2010 5:08 AM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
yes ! The alternative solution is use of third party distributed cache like NCache , which gives you scalable performance of ASP.NET and requires no code change in ASP.NET at all to work
Left by Ozoderm on Dec 11, 2010 9:16 PM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
Thank you very much. Very nice site.
Left by ilahi on Jan 05, 2011 2:11 AM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
asp.net is the best
Left by ozoderm on Feb 03, 2011 11:01 PM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
ev kristalsehir den alınır
Left by kristalsehir on Feb 03, 2011 11:09 PM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
el ilanı broşur katalog tasarım
Left by cokacilmatbaa on Feb 24, 2011 2:48 AM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
thank you for share. i like this post.
Left by cumayeri on Mar 19, 2011 3:11 AM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
It really is a cool project and thank you for share
Left by 101 on Mar 21, 2011 5:16 PM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
Thanks Admin Very Nice...
Left by Alabora on Mar 27, 2011 3:20 AM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
Thanks Admın Very Beatıful Very Nıce
Left by Seokolik on May 29, 2011 1:32 PM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
thank you for share. nice post
Left by e-ticaret on Jun 08, 2011 3:12 PM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
http://www.nba-jordan.com/
nba wallpapers
Left by nba jordan on Jun 27, 2011 11:33 PM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
thansk admin.very nice..
Left by Formates on Oct 02, 2011 9:11 PM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
everybody says same thing here
Left by kristal şehir on Dec 17, 2011 6:14 PM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
Sharing has been a very nice thank you..
Left by Creature on Jan 17, 2012 5:49 AM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
wonderful site thanks.
Left by nokta ayakkabi on Feb 08, 2012 4:24 PM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
wonderful site thanks.
Left by beklemeyin on Mar 09, 2012 2:43 PM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
thanks admin wndrful site
Left by justcarlove on Jul 08, 2012 7:51 PM

# re: ASP.NET 2.0 Performance Tuning Considerations

Requesting Gravatar...
thank you very mach very good
Left by Urfa on Sep 23, 2012 9:09 PM

Your comment:

 (will show your gravatar)