Configuring the embedded global cache to read data from replica shards of a cache map

You can configure your embedded global cache to read data from replica shards of a cache map instead of the primary cache map.

Before you begin

Complete the following steps:

About this task

If more than one container server exists, the default cache policy ensures that all data is replicated at least once, so that each container server can host primary and replica shards of the cache data. By default, data is read only from the primary shard but you can configure the embedded global cache to support read access to replica shards.

You define that your embedded global cache can read data from replica shards of a cache map by configuring the deployment.xml file. You then configure the embedded global cache by updating the server.conf.yaml configuration file for the integration server to point to the deployment.xml file. The embedded global cache can use only one deployment.xml file.

Procedure

  1. Open the deployment.xml file, and set the replicaReadEnabled parameter to true on the mapSet element.
    For example:
    <?xml version="1.0" encoding="UTF-8"?>
    <deploymentPolicy xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://ibm.com/ws/objectgrid/deploymentPolicy ../deploymentPolicy.xsd" 
       xmlns="http://ibm.com/ws/objectgrid/deploymentPolicy">
       <objectgridDeployment objectgridName="WMB">
          <mapSet name="mapSet" numberOfPartitions="13" minSyncReplicas="0" maxSyncReplicas="1" replicaReadEnabled="true">
             <map ref="USER.OPTIMISTIC.*"/>  
             <map ref="USER.PESSIMISTIC.*"/>
             <map ref="USER.NONE.*"/> 
             <map ref="SYSTEM.BROKER.*"/> 
             <zoneMetadata>
                <shardMapping shard="P" zoneRuleRef="wmbRule"/>   
                <shardMapping shard="S" zoneRuleRef="wmbRule"/>
                <zoneRule name="wmbRule" exclusivePlacement="false">  
                   <zone name="WMBZone"/>   
                </zoneRule>
             </zoneMetadata> 
          </mapSet>
       </objectgridDeployment>
    </deploymentPolicy>
    Note: If you add any additional map entries, you must add the equivalent entries in the objectgrid.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 deployment.xml file.
  3. Configure the location of the deployment.xml file in the integration server by modifying the deploymentPolicyCustomFile property in the server.conf.yaml configuration file.

    If you made changes to the objectgrid.xml file to keep the file consistent with the deployment.xml, you must also complete this step for your copy of the objectgrid.xml file. For information about the equivalent commands, see Configuring locking strategies for the embedded global cache.

  4. Restart the integration server for the changes to take effect.

Results

You have configured read access to replica shards of one or more cache maps in the IBM® App Connect Enterprise embedded global cache.