Cache monitor
Cache monitor is an installable web application that provides a real-time view of the current state of dynamic cache. We 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.
(ZOS) Cache monitor provides information on the cache in the servant to which your browser connects to interact with the monitor. In an environment that has multiple servants, cache monitor provides a partial view of caching activity.
Cache monitor provides a way to:
- Verify the configuration of dynamic cache
After we create multiple servlet cache instances in the administrative 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 file, found inside the web module WEB-INF or enterprise bean META-INF directory. Refer to the cachespec.xml file topic for more information about cacheable objects. Each cacheable object can have multiple cache ID rules that run in sequence until either a rule returns a cache ID or no more rules remain. If none of the cache ID generation rules produce a valid cache ID, then the object is not cached. There can be multiple cachespec.xml files with multiple cache ID rules. With cache monitor, we can verify the policies of each object. We can also view all of the cache polices for each cache instance that is currently loaded in dynamic cache. This view is also convenient to verify that the cachespec.xml file was read by the dynamic cache without errors.
- 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 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, that the pages have been cached in the correct cache instance with the right attributes such as time to live, priority, and that 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 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.
Subtopics
Related :
Display cache information Use servlet cache instances cachespec.xml file Dynamic cache service settings