Tuesday, 1 October 2013

IBM WCS Dynacache and getting the Extended Cache Monitor installed



As a top tier Enterprise Application catering to the eCommerce Market , One of the Addon Features that Websphere Commerce provides the DynaCache. Although IBM has other products aimed is specifically addressing Caching, since the DynaCache is integrated with WAS server it is a cost effective limited solution.
IBM Websphere eXtreme Scale is a powerful elastic cache solution for advanced cache solutions.

Caching is generally asscociated with static content such as graphics, images , files that rarely change. However, in this age of personalized experiences , websites serve personalized information or data depending on the end user and this changes frequently.

WAS  provides a built in service for caching , using which WCS provides caching of dynamic content using defined caching techniques.
Cachespec.xml is provided for the user to specify and control Caching and invalidation of Views ( Commands or JSP views ).
DynaCache as the name suggests is provided for caching Dynamic Content.


The Dynamic caching service includes :

- Servlet and JSP result cache
     Whole Pages or fragments of a page are cached.
- Command cache
      Commands that implement the CacheableCommand ( cache command objects )
- Edge Side Include (ESI) caching
     To assemble fragments and deliver complete dynamic web pages.
- Cache Invalidation
     Invalidation rules to flush out a cached resource when it may no longer be required based on
1. rule based
2 . time based
3. group based
4. programmatic.


 - Cache Replication  
    To enable cache sharing and replication across multiple servers.

- Disk offload capability
    The cache eats up a lot of valuable runtime memory space. Also the cache slots available is limited and Cached requests are flushed out to make space for new ones once the cache gets filled.
Also since the Cache is maintained in the runtime memory of the server on server restarts this gets lost. This might manifest as an issue on a live production server. 

Now If the Disk Offload is enabled ,
     Once the space allocated for the cache gets filled, The entries that are flushed/invalidated are moved to the Hard disk. The server would maintain an index of the Cache IDs in the disk cache. Thus a much higher number of cache entries can be maintained in the Application server .
Also , on server restarts since the offloaded cache is still available , the cache content is preserved.

    To enable caching large amounts of data, and to preserve cache content while the application server is stopped and restarted. 

Note: After the application server is restarted and the database is restored, it is recommended that you clear the disk cache using the cache monitor. Clear the disk cache to ensure that information that is invalid for the new database is removed. Use the cache monitor  http://host_name:Port/cachemonitor to clear the cache or, alternatively, use the following URL: http://host_name/path/DynaCacheInvalidation?clear=true.


Limitations of dynamic caching

If you use the cachespec.xml file to enable invalidation you might encounter the following behavior:
  • When you create a catalog entry or move a catalog entry from one category to another in the Management Center, the catalog entry would not show up on the storefront.
  • When you create a category in the Management Center, the category would not show up on the storefront.
  • When you update a child object in the Management Center, the parent object cache entry is not automatically invalidated. For example, when you update a catalog entry in the Management Center, the category display page does not reflect the updates in the storefront.
  • Similar anomalies might be encountered while using bod service commands to update changes in a different Backend Application , while the caching is done based on Commands and Views and there is no relevant invalidation configured based on bod service commands invoked. 

 Enabling Sevlet caching

 In order to enable servlet caching do the following. 
 Navigate to http://localhost:9060/admin  ( WAS admin console ) and to the Application server

Click on the Web container
 Select the check box. and click ok. Ensure to save changes to the Master Configuration.

 Installing the Cache Monitor 

The cache Monitor will enable you to view the Cache Content , cache ID , Dependency ID and cache statistics ( Cache Hit / Cache Misses ) etc. It can also be used to clean the cache or selectively invalidate a specific cache entry ( never advised ) .
The Cache Monitor can be installed as a new application on the WAS server. The CacheMonitor.ear can be found on a developer machine 
@ Location  ..\..\IBM\SDP\runtimes\base_v7\installableApps\

Navigate to http://localhost:9060/admin  ( WAS admin console )
Click on Install . 

Browse to the above mentioned file CacheMonitor.ear in the local file system. 

Click Next at the next three screens .
 Step1 , Step 2 Step 3 
Make sure to select CacheMonitor.ear  @ Step 2. 


The IBM Extended Cache Monitor for IBM WebSphere Application Server provides you with two functions that are not available with the cache monitor that is supplied with WebSphere Application Server. These two functions enable you to:
  • display the contents of object cache instances
  • display the Dynamic Cache mbean statistics for cache instances
 
 
The Extended cache Monitor can be installed as mentioned @
http://www.ibm.com/developerworks/websphere/downloads/cache_monitor.html

Incase you run into errors make sure of the following.
Note: The CacheMonitor.ear should be directly under the cachemonitor7_update.zip
 

5 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Hi, I am not able to view the cache content from the disk. Can you please let me know what is the configuration I need to enable for viewing the cache content from Disk. Can you please help urgently.

    ReplyDelete
  3. Hi, I am not able to view the cache content from the disk. Can you please let me know what is the configuration I need to enable for viewing the cache content from Disk. Can you please help urgently.

    ReplyDelete
  4. Phenq PhenQ is a all-natural dietary supplement for fat burning that combines the best qualities of many other supplements into a single pill.

    ReplyDelete