C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Articles » ASP.NET/Web Applications »

ASP.Net Performance


Posted Date: 18 Jan 2005    Resource Type: Articles    Category: ASP.NET/Web Applications
Author: SkMember Level: Silver    
Rating: 1 out of 5Points: 7



Introduction
Writing the web with ASP.Net is easy. So many developers do not take time to improve the performance of the application. There are different kind of the performance issue at different end such as database side, IIS end and ASP.Net. ASP.Net supports multi tier architecture like Web services and Remoting which already hit the performance. There are two types of performance improvements described in this article: large optimizations, such as using the ASP.NET Cache, and tiny optimizations that repeat themselves. These tiny optimizations are sometimes the most interesting. You make a small change to code that gets called thousands and thousands of times. With a big optimization, you might see overall performance take a large jump. With a small one, you might shave a few milliseconds on a given request, but when compounded across the total requests per day, it can result in an enormous improvement.
Paragraph Heading
There are different tier in which improve the performance.

1. Data Access
2. IIS
3. ASP.Net
4. Miscellaneous


1. Return multiple Result sets: While you can return multiple result set by the dynamic SQL better to use Stored Procedure. It reduced the network traffic. Keep all he business logic in procedure and pass the parameter.

2. Pagination: Data grid is good feature of pagination but it has certain disadvantages because the dataset keep all the records in the memory. So that performance goes down. Good approach to writing pagination code in the stored procedure. If the tables contains more then 1 Lakh rows, so that all rows comes in the memory then pagination will work. This is really no use of that. Try to retrieve only those records which you want to display.


3. IIS (If Only for Kernel Caching): There are good feature in the IIS (6.0) i.e. Kernel caching. When a request output cached by ASP.Net , IIS receives a copy of the cache data. This means when you are using the kernel mode caching you will unbelievable performance.

4. Round Trip: There are different methods to avoid the round trip of the server.

i). Caching: If your application fetching, static data and rendering you can avoid by caching.
ii). Server.Transfer: Use only server.tranfer because the request transfer form server to server but in the case of Response.redirect . The Request comes at the client end then goes to the server.

5. Use a DataReader for Fast and Efficient Data Binding: Use a DataReader object if you do not need to cache data, if you are displaying read - only data, and if you need to load data into a control as quickly as possible. The DataReader is the optimum choice for retrieving read-only data in a forward-only manner. Loading the data into a DataSet object and then binding the DataSet to the control moves the data twice. This method also incurs the relatively significant expense of constructing a DataSet.In addition, when you use the DataReader, you can use the specialized type-specific methods to retrieve the data for better performance.

6. Use StringBuilder for Temporary Buffers: In many cases it is not feasible to use Response.Write. For example, you might need to create strings to write to a log file or to build XML documents. In these situations, use a StringBuilder object as a temporary buffer to hold your data. Measure the performance of your scenario by trying various initial capacity settings for the StringBuilder object.

7. Disable View State If You Do Not Need It : Disable the view state when ever it is not required. You can disable either on page level, application level or control level.
Increased CPU cycles are required to serialize and to deserialize the view state.
Pages take longer to download because they are larger.
Very large view state can impact the efficiency of garbage collection.


8. Disable Session State If You Do Not Use It: you can disable the session either on the page level or application level.

9. Finalization:

Finalizable objects get promoted to older generations, which increases memory pressure and prevents the object's memory from being collected when the garbage collector determines the object is garbage. In addition, all objects referred to directly or indirectly by this object get promoted as well.

Forcing the garbage collector to execute a Finalize method can significantly hurt performance. Remember, each object is finalized. So if I have an array of 10,000 objects, each object must have its Finalize method called.

10. Exception Management:
Implement a Global.asax error handler.
Monitor application exceptions.
Use try/finally on disposable resources.
Write code that avoids exceptions.
Summary
Write a such code which enhance the performance of the application



Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Freezing Headers of the DataGrid in ASP.NET
Previous Resource: Choosing between typed and untypes datasets .
Return to Discussion Resource Index
Post New Resource
Category: ASP.NET/Web Applications


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use