Configure cache replication
Use this task to improve performance by configuring the data replication service (DRS) to replicate data from the dynamic cache service across the consumers in a replication domain.
Refer to the Cache replication article for more information about replicating data for the dynamic cache service.
We should have a replication domain created for the dynamic cache service. Configure a different replication domain for each type of consumer of the replication domain. For example, configure two different replication domains for dynamic cache and session manager. There are two ways to configure replication domains:
- To create replication domains manually, in the administrative console, click...
Environment > Replication domains
- To create a new replication domain automatically when we create a cluster, click...
Servers > Clusters > New
See Replicate data across application servers in a cluster.
Do not use the default value of a single replica for the Number of replicas for dynamic cache replication domains. Instead, use a full group replica for any replication domains that we configure for dynamic cache.
If we configured cache replication with a previous version of WebSphere Application Server, review the igrating servers from multi-broker replication domains to data replication domains article to learn about the new type of replication domains that we should use with the current version of WAS.
Enable the data replication service
- In the administrative console, click...
Servers > Server Types > WebSphere application servers > server > Container services > Dynamic cache service.
- To enable replication, select Enable cache replication.
- Choose a replication domain. Use different replication domains for each type of consumer. For example, dynamic cache should use a different replication domain than session manager. The only replication domains that we can select in this panel include replication domains configured to use full-group replication. In a full-group configuration, every cache entry is replicated to every other cache configured in the servers in the replication domain. If none of the replication domains in the configuration meet these requirements, the list is empty. In this case, create a replication domain or alter an existing replication domain so that we have a replication domain that can perform full-group replication. Refer to the Replicating data across application servers in a cluster article for more information.
- Define the dynamic cache replication settings. Click Enable cache replication. On this page, we can define when and how often data is replicated across the dynamic cache replication domain. For more information about these settings, refer to the Dynamic cache service settings article.
- To enable cache replication on a single server in a non-clustered environment, define the following JVM custom properties.
- In the administrative console, click...
Servers > Application Servers > server.
- (iSeries) Under Server Infrastructure, click Java and process management > Process definition > Java Virtual Machine > Custom properties > New.
- Under Server Infrastructure > Java and process management > Process definition > Servant > Java Virtual Machine > Custom properties > New.
- Add the new property name as DynacacheEnableUnmanagedServerReplication and set the value to true.
- Add another JVM property to specify the global sharing policy for the base z/OS server. Click New and add a new JVM custom property called DynacacheUnmanagedServerReplicationType. Using one of the following values:
Value Description NOT_SHARED Cache entries for this object are not shared among different application servers. These entries can contain non-serializable data. For example, a cached servlet can place non-serializable objects into the request attributes, if the class type supports it. PUSH Cache entries for this object are automatically distributed to the dynamic caches in other application servers or cooperating Java Virtual Machines (JVMs). Each cache has a copy of the entry at the time it is created. These entries cannot store non-serializable data. PULL Cache entries for this object are shared between application servers on demand. If an application server gets a cache miss for this object, it queries the cooperating application servers to see if they have the object. If no application server has a cached copy of the object, the original application server runs the request and generates the object. These entries cannot store non-serializable data. This mode of sharing is not recommended. PUSH_PULL Cache entries for this object are shared between application servers on demand. When an application server generates a cache entry, it broadcasts the cache ID of the created entry to all cooperating application servers. Each server then knows whether an entry exists for any given cache ID. On a given request for that entry, the application server knows whether to generate the entry or pull it from somewhere else. These entries cannot store non-serializable data. If we do not define one of these values, the default is NOT_SHARED.
- Define sharing policies in the cachespec.xml file.
(iSeries) This is optional.
(ZOS) To use cache replication among multiple servants on a base server, create a cachespec.xml file to define the cacheable objects to create.
We can override the global sharing policy by specifying a specific sharing policy in the cache policy. For example, if your global policy is to use Push only, we can change the sharing policy of a specific cache entry by making this change to the cache policy:<cache-entry> <sharing-policy>not-shared</sharing-policy> <class>servlet</class> <name>/app</name> <cache-id> <component id="action" type="parameter"> <value>portfolio</value> <required>true</required> </component> <component id="JSESSIONID" type="cookie"> <required>true</required> </component> <property name="EdgeCacheable">true</property> </cache-id> </cache-entry>For more information about the sharing policies that can be defined in the cachespec.xml file, refer to the cachespec.xml file article.
Cache entries copy to the other application servers in the configured replication domain.
What to do next
Use the cache monitor to view the contents of the cache. Refer to the Displaying cache information article for more information.
Subtopics
Replicating data across application servers in a cluster Task overview: Using the dynamic cache service to improve performance Migrate servers from multi-broker replication domains to data replication domains Displaying cache information Dynamic cache service settings cachespec.xml file