6. Data and Output CachingCaching is the act of storing something for later retrieval, and in the Web world it is used to improve performance. There are many factors that affect the performance of Web sites, and two of these are the processing of ASP.NET pages and fetching data from databases. Once a Web site has been launched, the pages themselves generally stay fairly static, with only data changing, and even then that doesn't always change frequently. Fetching data from a database is relatively slow and uses resources (process, memory, etc.), so if that usage can be minimized, performance can be improved. Likewise, if a page doesn't change, why process it on every request? Both of these problems can be solved with cachingstoring data so that it doesn't have to be processed or fetched. The performance impact of reducing resource usage may not be noticeable on small sites, but for larger sites with many users you can achieve dramatic improvements. In this chapter we're going to look at various caching schemes and how they can be used to improve performance. In particular, we will cover the following topics:
Some of these techniques are simple, while others require a little more thought. All of them, however, are easy to code. |