Chapter 5: Caching ASP.NET Applications


Highlights

Caching allows ASP.NET applications to store objects and Hypertext Markup Language (HTML) output in memory and then quickly retrieve them for multiple, repetitious client requests . Web applications commonly serve the same response to multiple clients . It becomes more efficient to serve a copy of the initial response, rather than regenerating the same response for every client request. Caching can significantly improve a Web application's performance and scalability, especially if the cached content includes result sets from database calls. Caching may also speed up an application's response time because the server does not have to spend as much (if any) processing time on the request.

ASP.NET provides a sophisticated set of options for caching content, including the ability to cache portions of a Web page, rather than the entire page. In addition, ASP.NET provides a Cache API that enables you to cache individual objects and data. Caching was first discussed in Chapter 3, "Writing Optimized Data Access Code," where we referred to it as transient application state management . This term highlights two important aspects about caching: It is temporary, and it is scoped at the application level.

Caching does come with tradeoffs, which are important to understand before you implement this feature into your Web application. In this chapter we discuss how caching works and what the benefits and tradeoffs are with each caching option. We also look at more advanced topics, such as how caching works in Web farms.

Note

Caching is a primary factor in your application's design, and you should factor it in from Day 1. It is more difficult to retrofit a mature application for caching, than it is to incorporate caching early in the design. Take full advantage of ASP.NET's caching options because caching can significantly improve the performance and scalability of your Web application.




Performance Tuning and Optimizing ASP. NET Applications
Performance Tuning and Optimizing ASP.NET Applications
ISBN: 1590590724
EAN: 2147483647
Year: 2005
Pages: 91

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