Before you start
About this tutorial
In this tutorial, you can learn how to cache Servlet objects, JSP pages, WebSphere Command objects using the dynamic caching service of was, and how to Cachespec.xml A build class implementation that configures or writes a unique identity in a file caches different versions of the same object, depending on the business needs. This tutorial also covers the direct manipulation of dynamic caching and the use of cache monitor to monitor and manage dynamic caching.
Goal
After completing this tutorial, you should learn how to:
Configuring the Cachespec.xml Cache Servlet or JSP page
Configure cache rules in Cachespec.xml to cache different versions of the same Servlet object or JSP page
Writing a WebSphere Command object
Write Java Class with unique identification of the build cache
Direct operation of dynamic cache
Install and use Cache Monitor
Prerequisite
To successfully use this tutorial, you should be familiar with the general knowledge of Java development, especially with the basics of server-side Java development. You should understand the general concepts of was and rational®application Developer for Websphere®software (RAD) and familiarize yourself with the basic Java EE concepts of deployment descriptors and WAR archives, and the configuration of was and management knowledge.
System Requirements
You need to download the following required (free) applications to use this tutorial and the sample code in:
Ibm™rational®application Developer for Websphere®software
Ibm™websphere®application Server 6.1 or above
If the reader is unable to obtain an official version of RAD and was, consider downloading and using Rad's beta and websphere®application Server for developers. If the reader does not want to download the RAD trial version, the author also provides a source code package dynacachetutorial.zip for direct compilation, downloads and unzip it to a directory, and modifies the directory of was of the Was.app.dir value in the Was.properties file. Then run "Ant War" to compile. Using this method, the user can modify the code and compile the installation directly with your favorite editor.
The hardware configuration should include support for the software listed above and a minimum of 2GB memory (recommended 3GB). The instructions in this tutorial are based on the microsoft®windows® operating system, but are also applicable to the linux® and UNIX® operating systems.
Introduction
was dynamic cache overview
High-speed dynamic caching as an extended service for was is included in the versions from the 5.0.2 start. This service can cache the output of the WebSphere Command object, Servlet, and JavaServer Pages (JSP), thereby significantly improving application performance. The dynamic caching service, located inside the application Server Java virtual machine (JVM), implicitly implements a call to caching by intercepting calls to a cache object, and the programmer is not even aware of its existence. Figure 1 shows the process of the system in two cases of cache hits and misses, and the execution time of the business logic is greatly shortened if the cache hit avoids the execution of the complex business logic behind it.
Figure 1. Cache Hits and failures