Configuring locking strategies for the embedded global cache

You can configure your embedded global cache to use locking strategies to suit the types of data that you store in your cache.

Before you begin

Complete the following steps:

About this task

You define the locking strategy for each cache map in your embedded global cache by configuring the objectgrid.xml file. You then configure the embedded global cache by using one of the following methods:
  • Place the objectgrid.xml file in a directory of the IBM® Integration Bus work path.
  • Use the mqsichangeproperty command to set a property on the integration node cache manager to point to the objectgrid.xml file.
  • Use the mqsichangeproperty command to set a property on the integration server cache manager to point to the objectgrid.xml file.
The embedded global cache can use only one objectgrid.xml file. Any property settings, if set, are used in the following order of precedence:
  • Integration server (if no policy is set on the integration node)
    Note: If a policy is set on the integration node, the integration server inherits the properties of the integration node, and any properties set directly on the integration server are overwritten.
  • Integration node
  • IBM Integration Bus work path
Note: If you choose to configure the property on more than one integration server (or integration node) in the same IBM Integration Bus installation, the properties must result in the same map configuration to ensure consistency.

Procedure

  1. Open the objectgrid.xml file, and configure the locking strategy for each backingMap entry by completing one of the following steps:
    • To configure the pessimistic locking strategy for a cache map, set the lockStrategy parameter to PESSIMISTIC.
      For example:
      <backingMap name="USER.PESSIMISTIC.*" template="true" timeToLive="0" ttlEvictorType="LAST_UPDATE_TIME" lockStrategy="PESSIMISTIC" copyMode="COPY_TO_BYTES"/>
    • To configure the optimistic locking strategy for a cache map, set the lockStrategy parameter to OPTIMISTIC_NO_VERSIONING. If your integration node has a function level of 10.0.0.2 or later, you can also set the nearCacheInvalidationEnabled parameter to true.
      For example:
      <backingMap name="USER.OPTIMISTIC.*" template="true" timeToLive="0" ttlEvictorType="LAST_UPDATE_TIME" lockStrategy="OPTIMISTIC_NO_VERSIONING" nearCacheInvalidationEnabled="true" copyMode="COPY_TO_BYTES"/>
    • To configure no locking for a cache map, set the lockStrategy parameter to NONE. If your integration node has a function level of 10.0.0.2 or later, you can also set the nearCacheInvalidationEnabled parameter to true.
      For example:
      <backingMap name="USER.NONE.*" template="true" timeToLive="0" ttlEvictorType="LAST_UPDATE_TIME" lockStrategy="NONE" nearCacheInvalidationEnabled="true" copyMode="COPY_TO_BYTES"/>
    Note: Enabling near-cache invalidation removes stale data from the cache as quickly as possible. For more information, see the WebSphere® eXtreme Scale documentation, https://www.ibm.com/support/knowledgecenter/SSTVLU_8.6.0/com.ibm.websphere.extremescale.doc/txsnearcacheinv.html. However, you can include the nearCacheInvalidationEnabled parameter only if the function level of the integration node (and any other integration nodes in a multi-integration node topology) is 10.0.0.2 or later. For information about changing the function level of an integration node, see Changing the function level of your integration nodes.
    The following example file shows three entries, and includes an entry (SYSTEM.BROKER.*) that matches the default cache map for the IBM Integration Bus embedded global cache.
    Note: You can modify the locking strategy for the SYSTEM.BROKER.* entry but you must not remove the entry.
    <?xml version="1.0" encoding="UTF-8"?>
    <objectGridConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xsi:schemaLocation="http://ibm.com/ws/objectgrid/config ../objectGrid.xsd" 
      xmlns="http://ibm.com/ws/objectgrid/config"> 
     <objectGrids>
      <objectGrid name="WMB">
       <backingMap name="USER.OPTIMISTIC.*" template="true" timeToLive="0" ttlEvictorType="LAST_UPDATE_TIME" lockStrategy="OPTIMISTIC_NO_VERSIONING" nearCacheInvalidationEnabled="true" copyMode="COPY_TO_BYTES"/>
       <backingMap name="USER.PESSIMISTIC.*" template="true" timeToLive="0" ttlEvictorType="LAST_UPDATE_TIME" lockStrategy="PESSIMISTIC" copyMode="COPY_TO_BYTES"/>
       <backingMap name="USER.NONE.*" template="true" timeToLive="0" ttlEvictorType="LAST_UPDATE_TIME" lockStrategy="NONE" nearCacheInvalidationEnabled="true" copyMode="COPY_TO_BYTES"/>
       <backingMap name="SYSTEM.BROKER.*" template="true" timeToLive="0" ttlEvictorType="LAST_UPDATE_TIME" lockStrategy="PESSIMISTIC" copyMode="COPY_TO_BYTES"/>
      </objectGrid>
     </objectGrids>
    </objectGridConfig>
    Note: If you add any additional backingMap entries, you must add the equivalent entries in the deployment.xml; see Optimizing the embedded global cache for use with different types of cache data. You cannot configure any other options in this file.
  2. Save the objectgrid.xml file and complete one of the following steps to configure the embedded global cache to use the properties from the file:
    • Copy objectgrid.xml to the workpath/common/wxs directory, where workpath is the IBM Integration Bus work path, and then restart your integration node.
      Note: To verify the work path for your IBM Integration Bus installation, run the command mqsireportbroker integrationNode.
    • Configure the location of the objectgrid.xml file in the integration node by running the following command:
      mqsichangeproperties integrationNode -b cachemanager -o CacheManager -n objectGridCustomFile -v pathName/objectgrid.xml
      where pathName is the directory where you saved your objectgrid.xml file.
    • Configure the location of the objectgrid.xml file in the integration server by running the following command:
      mqsichangeproperties integrationNode -e integrationServer -o ComIbmCacheManager -n objectGridCustomFile -v pathName/objectgrid.xml
      where pathName is the directory where you saved your objectgrid.xml file.
      Note: You can change properties on an integration server only if a policy is not set on the integration node.
    Note: If you made changes to the deployment.xml file to keep the file consistent with the objectgrid.xml, you must also complete this step for your copy of the deployment.xml file. For information about the equivalent commands, see Configuring the embedded global cache to read data from replica shards of a cache map.

Results

You have configured the IBM Integration Bus embedded global cache to use one or more locking strategies.