![]() |
Web Development »
ASP.NET »
General
Beginner
License: The Code Project Open License (CPOL)
ASP.NET Web Site Performance ImprovementBy Ashrafur RahamanTips to speed up your ASP.NET applications. |
XML, .NET, ASP.NET, Dev, SysAdmin
|
|
Advanced Search Add to IE Search |
|
|
|
||||||||||||||||
Recently, I developed a web application which calls many services and loads a lot of data in every page with a lot of calculation in the background from the database, so the site became slower. Then, I started searching Google to find out a good solution, and got some real good ideas to improve my web application's performance. Here, in this article, I am sharing the tips I applied in the application to improve its performance, and it really works fine now.
HTTP compression is used to compress page content from the server end. It compress HTTP requests and responses, so is a great performance improvement. My project is hosted in Windows Server 2003, and I implemented HTTP compression after reading this article.
View State allows the page state to be persisted with the client, and it does not require cookies or server memory. View State saves data in a hidden input filed inside a page. Definitely, it is a powerful feature, but the drawback is it increases page size and memory allocation in the server.
So, we should avoid View State where it is not necessary. Especially, in the case of DataGrid controls, we should avoid View State as it loads all the grid data in the page state.
In my application, I disabled View State for most of the controls and pages where View State is not necessary. THis made the page sizes smaller.
This will save your page only for a certain amount of time, and the page will be faster to load. But, remember that if your page data changes frequently, it is not a good idea to use page caching.
<caching>
<outputCacheSettings>
<outputCacheProfiles>
<add name="cached" duration="600"
varyByParam="none" enabled="true"/>
</outputCacheProfiles>
</outputCacheSettings>
</caching>
httpModules from the web.config:<add name="ScriptModule"
type="System.Web.Handlers.ScriptModule, System.Web.Extensions,
Version=3.5.0.0, Culture=neutral,
PublicKeyToken=31BF3856AD364E35"/>
<remove name="WindowsAuthentication" />
<remove name="PassportAuthentication" />
<remove name="AnonymousIdentification" />
<remove name="UrlAuthorization" />
<remove name="FileAuthorization" />
<trace enabled="false" pageOutput="false" />
<profile enabled="true" automaticSaveEnabled="false" />
debug=false:<compilation debug="false">
Three types of cache dependencies are available:
For my project, I used cache dependency on file. For your project, you can choose to use a dependency based on which will be the best fit for your application. Here is a nice example of cache dependency on file.
It is important to clean up style sheets and remove unnecessary code from style sheets because it increases the load time. Remove all unnecessary classes from style sheets and try to use a single CSS file. In my project, I have used a tool to reduce the size of my stylesheet. I used this service to reduce the size of my CSS file by 20%.
I optimize my JavaScript using this service.
According to the advice from some good articles, I put the CSS file declaration at the top of my master page. It is recommended to call CSS files at the top of a page because the page rendering will progressively become efficient.
I put JavaScript file links at the bottom of the main master file. If we put scripts at the top of the page, then it will cause unnecessarily high load times.
Where possible, I use server.transfer() instead of response.redirect(). It loads pages faster because it posts only the form, not the complete page.
For page validation, I use client-side validations instead of postbacks. This way, I reduce round trips in pages.
There are many more things that can be done to improve the performance of a web application. Given below are the links of some very good articles:
I plan to add more performance tuning tips in the future.
| You must Sign In to use this message board. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
General
News
Question
Answer
Joke
Rant
Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads.
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 28 May 2009 Editor: Smitha Vijayan |
Copyright 2009 by Ashrafur Rahaman Everything else Copyright © CodeProject, 1999-2010 Web19 | Advertise on the Code Project |