Troubleshoot tips for the dynamic cache service
The dynamic cache service works within an appserver Java virtual machine (JVM), intercepting calls to cacheable objects. This article describes some common run-time and configuration problems and remedies.
Servlets are not cached
Recommended response Enable servlet caching. On the Web container page of the administrative console, select the Enable servlet caching check box.
Cache entries are not written to disk
Explanation Cache entries are written to disk when the cache is full and new entries are added to the memory cache. Cache entries also are written to disk when the flushToDiskOnStop system property is set and the server is stopped. Recommended response Verify that Disk offload is enabled on the Dynamic Cache Service page of the administrative console. Also verify that cache entries written to disk are serializable and do not have the PersistToDisk configuration set to false.
Some servlets are not replicated or written to disk
Recommended response Ensure that the attributes and response are serializable. If the you do not want to store the attributes, use the following property in your cache policy<property name="save-attributes">false</property>
Dynamic cache service does not cache fragments on the Edge
Recommended response Set the EdgeCacheable property to true in the cache policy for those entries that are to be cached on the Edge<property name="EdgeCacheable">true</property>
Dynamic cache invalidations are not sent to the IBM HTTP Server (IHS) plug-in
Explanation The DynaCacheEsi.ear file is required to send invalidations to external caches. Recommended response Install DynaCacheEsi.ear using the administrative console.
Cache entries are evicted often
Problem The cache is full and new entries are added to the cache. Explanation Cache entries are evicted when the cache is full and new entries are added to the cache. A LRU eviction mechanism removes the least recently used entry to make space for the new entries. Recommended response Either enable Disk offload on the Dynamic Cache Service page of the administrative console so the entries are written to disk. Or, increase the cache size to accommodate more entries in the cache.
Cache entries in disk with timeout set to 0 expire after one day
Explanation The maximum lifetime of an entry in disk cache is 24 hours. A timeout of 0 in the cache policy configures these entries to stay in disk cache for one whole day, unless they are evicted earlier. Recommended response Set the timeout for the cache policy to a number greater than 0.
I cannot monitor cache entries on the Edge
Explanation Use the cache monitor for monitoring contents in memory cache, disk cache and external caches (Edge cache). For the ESI processor's cache to be visible in the cache monitor, the DynaCacheEsi.ear application must be installed and the esiInvalidationMonitor property must be set to true in the plugin-cfg.xml file. Recommended response Install the DynaCacheEsi.ear application and set the esiInvalidationMonitor property to true in the plugin-cfg.xml file.
I want to cache static contents using the dynamic cache service
Explanation You can cache static contents using the dynamic cache service. Static contents in WebSphere appserver are served by the SimpleFileServlet file. Recommended response Create a cache policy for the class com.ibm.ws.webcontainer.servlet.SimpleFileServlet.class to cache static contents. It is advisable to use the dynamic cache service for caching more expensive dynamic contents than static contents.
I want to tune cache for my environment
Recommended response Use the Tivoli Performance viewer to study the caching behavior for your applications. Also, do the following...
- Increase the priority of cache entries that are expensive to regenerate.
- Modify timeout of entries so that they stay in memory as long as they are valid.
- Enable disk offload to store LRU evicted entries.
- Increase the cache size.
See AlsoUsing the dynamic cache service to improve performance