WAS v8.5 > Monitoring > Monitoring Dynamic caching > Display cache informationCache monitor
Cache monitor is an installable web application that provides a real-time view of the current state of dynamic cache. You use it to help verify that dynamic cache is operating as expected. The only way to manipulate the data in the cache is using the cache monitor. It provides a GUI interface to manually change data.
Cache monitor provides a way to:
- Verify the configuration of dynamic cache
After creating servlet cache instances in the dmgr console, we can configure properties, including the maximum size of the cache and disk offload location on each cache instance, as well as advanced features such as controlling external caches. We can verify the configuration of the dynamic cache by viewing of the configured features and properties in the cache monitor.
- Verify the cache policies
To cache an object, unique IDs must be generated for different invocations of that object. To create unique IDs for each object, provide rules for each cacheable object in the cachespec.xml
- Monitor cache statistics
We can view the essential cache data, such as number of cache hits, cache misses, and number of entries in each cache instance. With this data, we can tune the cache configuration to improve the dynamic cache performance. For example, if the number of used entries is often high, and entries are being removed and recreated, consider increasing the maximum size of the cache or enabling disk offload.
- Monitor the data flowing through the cache
Once a cacheable object is invoked, dynamic cache creates a cache entry for it containing the output of the actions that are performed and metadata, such as time to live, sharing policy, and so on. Entries are distinguished by a unique ID string based on the rules specified in the cachespec.xml file for the particular object name. Objects with the same name might generate multiple cache IDs for different invocations, based on request parameters and attributes for each invocation. We can view of all the cache entries that are in the cache instance, based on the unique ID. We can also view the group of cache entries that share a common name (also known as template). Cache entries can also be grouped together by a dependency ID, which is used to invalidate the entire group of entries dependent on a common entity. Therefore, cache monitor also provides a view of the group of cache entries that share a common dependency ID.
For each entry, cache monitor also displays metadata, such as time to live, priority and sharing-policy, and provides a view of the output that has been cached. This helps you verify which pages have been cached, the pages have been cached in the correct cache instance with the right attributes such as time to live, priority, and the pages have the right content.
- Monitor the data in the edge cache
Dynamic cache provides support to recognize the presence of an Edge Side Include (ESI) processor and to generate ESI include tags and appropriate cache policies for edge cacheable fragments. With the ESI processor, we can cache whole pages, as well as fragments, providing a higher cache hit ratio. There can be multiple ESI processors running on multiple hosts configured for caching.
We can view a list of all ESI processes and their hosts that are enabled for caching. Select a host or a processor, and view the edge cache statistics for it and the current cache entries.
- View the data offloaded to the disk
By default, when the number of cache entries reaches the configured limit for a given server, cache entries are removed, enabling new entries to enter the cache service. With disk offload, the removed cache entries are copied to disk for future access. We can view the content that is copied to disk that corresponds to the view of the contents cached in memory for each cache instance.
- Manage the data in the cache
We can perform the following basic operations on the data in the cache:
- Remove an entry from a cache instance
- Remove all entries for a certain dependency ID
- Remove all entries for a certain name (template)
- Move an entry to the front of the least recently used queue to avoid removal of the cache entry
- Move an entry from the disk to the memory within a cache instance
- Clear the entire contents of the cache instance
- Clear the contents of the disk for the cache instance
With these operations, we can manually change the state of the cache without having to restart the server.
Portlet To Empty Selected Dynacaches
Alex Lang has written a portlet that allows a users to select one or more caches to be cleared. The portlet notes the date and time that these selected caches were last cleared. Here is the portlet along with the source code: ManageCachesPortletThis portlet uses WebSphere APIs that require the user to have at least "Monitor" rights in the WAS console. To satisfy this requirement, I created a group, "WASMonitors". I created a page in the Portal upon which I've placed this portlet, gave the "Privileged User" role to this group for that page. Further, in the WAS console, under "Global security > Administrative group roles" I granted this group the role of "Monitor". All this insures that anyone using the ManageCaches portlet will have the appropriate rights to use the WebSphere MBeans utilized in the portlet.
Subtopics
Related concepts:
Display cache information
Use servlet cache instances
cachespec.xml file
Dynamic cache service settings