ASP.NET Optimization

 <  Day Day Up  >  

Nearly all the solutions we have discussed in this book are built on .NET. Some special considerations apply to optimizing .NET applications. Some of these are common to many programming architectures, while others are especially important for .NET.

  • Cache data and output wherever possible . With luck, your portal receives millions of hits per day. This translates into many times as many millions of disk accesses . If each hit means a new database query, the database server bears the entire load. The integrated cache included in .NET can dramatically reduce the time required to serve these pages by caching entire web pages, fragments of pages, or other objects. The ASP.NET programming model lets you design your pages with caching in mind to optimize performance of high-traffic areas of your portal. Appropriate use of caching is the single most important technique you can use to boost performance of your site.

  • Manage session state provider carefully . ASP.NET provides three distinct ways to store session data for your application: in-process session state, out-of-process session state as a Windows service, and out-of-process session state in a SQL database. Each has its advantages, but in-process session state offers the best performance by far. For small amounts of volatile data in session state, use the in-process provider. The out-of-process solutions are primarily useful in web garden and web farm scenarios when you cannot lose data in the event of a server/process restart.

  • Disable session state when not in use . Managing session state requires server resources. When applications or pages do not require per- user session state, disable it.

  • Avoid excessive round trips to the server . As with caching, design to get the most out of each time a user moves from one page to another, or fills out a new form.

  • Avoid excessive server control view state . Automatic state management can hurt performance although it is a convenient feature. Be conscious of when you really need ViewState and when you do not.

  • Use server controls sparingly . Don't use server controls when another rendering or data-binding approach would work better and offer superior performance.

  • Use web gardening for multiprocessor computers . Web gardening is a technique for distributing the work to several processes on a multiprocessor machine, one for each CPU, each with processor affinity set to its CPU. Some applications can achieve significant performance boosts with this technique.

  • Do not rely on exceptions in your code . Because exceptions are very expensive in terms of performance, they should rarely occur in your code.

  • Port call- intensive COM components to managed code . While the .NET Framework allows interoperability with traditional COM components, be sure that you are not paying too high a price in performance. If so, manage these components to managed code.

  • Use SQL stored procedures for data access . The n -tier application architecture provides the most scalable web applications. This means using stored procedures in SQL to generate data, which is passed to middle- tier objects.

 <  Day Day Up  >  


Building Portals, Intranets, and Corporate Web Sites Using Microsoft Servers
Building Portals, Intranets, and Corporate Web Sites Using Microsoft Servers
ISBN: 0321159632
EAN: 2147483647
Year: 2004
Pages: 164

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net