Chapter 12 Data Caching for Performance



One of the most common methods of increasing performance in an application is to provide data caching. Having the data available locally keeps you from repeatedly opening a database connection and making roundtrips to the server. Reducing the number of trips to the server means that more database resources and network bandwidth are available for other users and additional functionality. Caching can thus increase your overall performance.

Writing effective caching code can be quite a challenge because you need to know when the cache should expire (when the data is stale). For read-only data, this isn't too difficult to determine because you can simply choose to refresh the data when the application is restarted. For data that is updated occasionally, you can use timed expiration, such as at a specific time every day or after the cache hasn't been used for a certain amount of time. The problem with implementing timed expiration on a data cache is that one user might enter data that another user expects to see immediately and then doesn't see (or worse, the second user then attempts to reenter the data).

Microsoft ASP.NET offers many ways to cache Web pages, partial Web pages, and data. This chapter focuses on data caching only, but if you are a Web developer, I strongly suggest that you look at the other ASP.NET caching mechanisms.

This chapter explores some of the ways you can optimize performance by caching data and how you can minimize the effects of stale data.


Programming Microsoft ADO. NET 2.0 Applications. Advanced Topics
Linux Application Development (2nd Edition)
ISBN: 735621411
EAN: 2147483647
Year: 2004
Pages: 85
Authors: Michael K. Johnson, Erik W. Troan
BUY ON AMAZON © 2008-2017.
If you may any questions please contact us: