Chapter 4. The Caching Application Block


Many Enterprise Applications focus on moving data and presenting data to users in unique and interesting ways. Yet, all of this data does not necessarily need to be retrieved from a backend database for every request. Data that is semi-static, nontransactional, and consumed frequently or is expensive to create, obtain, or transform is ideal for caching. Caching helps not only reduce the amount of data that is transferred between processes and computers, but it also helps reduce the amount of data processing that occurs in a system and the number of disk access operations that must occur. Unfortunately, leveraging caching techniques to improve the performance and scalability metrics in enterprise applications is an important area that is too often overlooked.

For application architects, it is not good enough to design applications that solve specific business problems. An application that "does the job" but does not perform or scale well will eventually see little use. Even if users are attracted to the application at first, as performance degrades and the application is deemed unreliable, users will turn away. Unless thorough stress testing is performed, these types of problems rarely show themselves early on. It is the architect's responsibility to ensure that applications and systems are designed to meet performance, scalability, and availability needs.

It would be ideal to have service-level agreements in place that detail the metrics that need to be met for a specific application or system; however, reality does not always match ideology. It is often the case that systems and applications must be designed without specific information about how the application needs to perform or scale. This, however, is not an excuse to design a system that does not perform or scale well. Architects must strive for a design that overcomes these challenges. It is important to remember that caching isn't something that can typically be added to an application at any point in the development cycle; the application should be designed with caching in mind.

The Microsoft patterns & practices team has published a lot of excellent information on caching best practices, most notably the Caching Architecture Guide for .NET Framework Applications.[1] The section in the chapter that covers the design of the Caching Application Block details how the recommendations in this guide are core to the design of Enterprise Library's Caching Application Block. The chapter describes how the application block has been designed for extensibility and provides examples for how to extend it. It also shows how to configure and develop an application so that it can benefit from the features of the Caching Application Block.

[1] Found at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/CachingArch.asp.

Note that much of the information in this chapter is not new; rather, it is a combination of parts of the Caching Architecture Guide for .NET Framework Applications document and the Enterprise Library documentation for the Caching Application Block. Most of the new information in this chapter is where I show how to extend the Caching Application Block by way of a custom Cache Storage Provider, expiration policy, and callback. I don't repeat all the information found in these guides, but I focus on the parts that are specific to Enterprise Library's implementation for caching.




Fenster Effective Use of Microsoft Enterprise Library(c) Building Blocks for Creating Enterprise Applications and Services 2006
Effective Use of Microsoft Enterprise Library: Building Blocks for Creating Enterprise Applications and Services
ISBN: 0321334213
EAN: 2147483647
Year: 2004
Pages: 103
Authors: Len Fenster

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