Wednesday, March 08, 2006

Java Object Caching with WebSphere Dynamic Caching

The Dynamic cache service of WebSphere Application Server works within the server Java Virtual Machine. The advantage of using WebSphere for caching is that the cache distribution will be handled by the application server. The WebSphere Dynamic Cache can be used to cache servlets, WebSphere Commands, Web Services and - through the DistributedMap and DistributedObjectCache interfaces - the Java Objects from within J2EE applications on the server. Our focus here is on caching Java Objects from within J2EE applications. The DistributedMap and DistributedObjectCache interfaces provide simple interfaces for interacting with dynamic cache.In order to handle updates and invalidations, WebSphere allows you to declare dependencies on other objects. Element grouping may thus be achieved based on the element
dependencies. WebSphere Application Server also offers a Web Application called Cache Monitor, which plugs into the cache to provide a view of its contents and statistics. The dynamic cache uses the
Least Recently Used (LRU) algorithm to create space for incoming entries. Dynamic cache can also be configured to push data to a disk cache when assigned memory is full. Dynamic cache can take advantage of
WebSphere Data Replication Service (DRS) to replicate cache in a
cluster.
  1. Dependencies: A feature of WebSphere Application Server V6.
  2. Element grouping: Element grouping through dependencies.
  3. Configurable runtime parameters: Can be configured in cacheinstances.properties file or using WebSphere Application Server Administrative console.
  4. Security: The cache instances will be available as JNDI resources in the server. Hence they will be accessible to all the applications running on the server. Cache instances can only be protected by securing the JNDI resources.
  5. Region data separation and configuration: Cache elements have to be separated into different cache instances.
  6. Element event handling: Applications may define invalidation listeners and change listeners.
  7. Fine grained element configuration options: Dynamic Cache service provides API to control the configuration options at individual element level. This can be achieved through the following put method in the DistributedMap interface.
Relevant links:
  1. WebSphere Dynamic Cache: Improving J2EE application performance [PDF] [HTML]
  2. WebSphere V6 Information Center: Dynamic Caching

2 comments:

  1. Do you know if the interfaces support thread synchronization (isolation levels) across cluster instances? can you wind up with a race condition across the cluster?

    Thanks in advance,
    Reza

    ReplyDelete
  2. One more important feature of Object Cache is that it is replicable in clustered configuration. So, if you have any data which you want to put in ApplicationContext, you can keep it here, as ApplicationContext objects are not replicable.

    Regards,
    Satish.

    ReplyDelete

Popular Posts