WebSite Performance WebSite Performance

   You can boost performance of web application by reducing round trips from client to web server and web server to database server.
   Here are some tips that will help you.

1. HttpResponse.IsClientConnected.
   This property will tell server whether client is still connected to the server or not. If it is still connected you can process the request to perform operations on it.

2. Caching
   If you are fetching the data which is almost static, you can consider use of caching. So, when next user request the data he will get it from CACHE.

3. Server.Transfer
   Where ever possible use Server.Transfer instead of Response.Redirect. If you had used Response.Redirect in your code, client gets redircted page address in header
   with status code 302 then ceint request the url found in header.

4. View state
   Avoid storing state of object in view state. During post back you will post unnecessory data in hiddenField called __VIEWSTATE.

5. WEB.Config
    If you are not using Session module, you can remove it by overrriding default behaviour maching.config using web.config.
    same way you can disable out put caching, authentication and authorization mechanisems.

6. Web Gardening
    Add multiple worker process in Application pool. This will boost the performance of your application.
    Adding multiple worker proccess to your application pool will consume more memory.
    Note: If your application is using session, you need to store the session out of process. You can use SQL server or State server.
    This will help worker process to access shared session values across the worker process.

7. Web Farmng
   Create multiple instances of your web application on multiple machines and bring those machines into NLB cluster (Network load balancer)
   It will increas availability of your web application.

8. Exceptions
    Avoid exceptions to occur.

9.  Ensure Debug Is Set to False    
     When debug is set to true, following occurs
     Pages do not time out.
     Additional files are generated in the Temporary ASP.NET Files folder. which creates extra I/O operations.
     make debug false in both web.config and at page level
    <compilation debug="false" ... />
    <%@ Page debug="false" ... %>

10. Optimize Expensive Loops
Use For loop instead of ForEach loop when performance is important for the operation.

11. Server Controls
     Turn off ViewState properties of server side control if not required.
     avoid creating deep hirarchies of controls
     use server controls whenever required else use html controls.

12. Data Binding    
      if it is inefficiently used will hit performance measures. 
      Avoid Page.DataBind instead use control specific DataBind method
      Avoid performing DataBinder.Eval operations of controls.




High performance aspnet Interview Questions for 2 years or 3 years experianceWhat is web garden in to open a blog websiteasp net image 2.0 step by step Membership Provider How To Add Google Map To File HandlingHack Convert String To Convert Image To Base64


My name is Satalaj, but people call me Sat. Here is my homepage: . I live in Pune, PN and work as a Software Engineer. I'm former MVP in year 2010.
Disclaimer: Views or opinion expressed here are my personal research and it has nothing to do with my employer. You are free to use the code, ideas/hints in your projects. However, you should not copy and paste my original content to other web sites. Feel free to copy or extend the code.
If you want to fight with me, this website is not for you.

I'm Satalaj.