In a distributed WebSphere® eXtreme Scale environment, the client side has a near cache by default when using the optimistic locking strategy or when locking is disabled. The near cache has its own local cached data. If an eXtreme Scale client commits an update, the update goes to the client near cache and server. However, other eXtreme Scale clients do not receive the update information and might have data that is out of date.
Applications must be aware of this stale data issue in eXtreme Scale client. You can use the built-in Java™ Message Service (JMS)-based ObjectGridEventListener class, com.ibm.websphere.objectgrid.plugins.builtins.JMSObjectGridEventListener, to enable the client invalidation mechanism within a distributed eXtreme Scale environment that is known as an eXtreme Scale grid.
The client invalidation mechanism is the solution for the issue of stale data in client near cache in distributed eXtreme Scale environment. This mechanism ensures that the client near cache is synchronized with servers or other clients. However, even with this JMS-based client invalidation mechanism, the client near cache does not immediately update. A delay occurs when the eXtreme Scale runtime publishes updates.
For more information, read about the JMS event listener.
client-server model XML example <?xml version="1.0" encoding="UTF-8"?> <?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="AgentObjectGrid"> <bean id="ObjectGridEventListener" className="com.ibm.websphere.objectgrid.plugins.builtins.JMSObjectGridEventListener"> <property name="invalidationModel" type="java.lang.String" value="CLIENT_SERVER_MODEL" description="" /> <property name="invalidationStrategy" type="java.lang.String" value="PUSH" description="" /> <property name="mapsToPublish" type="java.lang.String" value="agent;profile;pessimisticMap" description="" /> <property name="jms_topicConnectionFactoryJndiName" type="java.lang.String" value="defaultTCF" description="" /> <property name="jms_topicJndiName" type="java.lang.String" value="defaultTopic" description="" /> <property name="jms_topicName" type="java.lang.String" value="defaultTopic" description="" /> <property name="jms_userid" type="java.lang.String" value="" description="" /> <property name="jms_password" type="java.lang.String" value="" description="" /> <property name="jndi_properties" type="java.lang.String" value="java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory;java.naming.provider.url= tcp://localhost:61616;connectionFactoryNames=defaultTCF;topic.defaultTopic=defaultTopic" description="jndi properties" /> </bean> <backingMap name="agent" readOnly="false" pluginCollectionRef="agent" preloadMode="false" lockStrategy="OPTIMISTIC" copyMode="COPY_ON_READ_AND_COMMIT" ttlEvictorType="LAST_ACCESS_TIME" timeToLive="28800" /> <backingMap name="profile" readOnly="false" pluginCollectionRef="profile" preloadMode="false" lockStrategy="OPTIMISTIC" copyMode="COPY_ON_READ_AND_COMMIT" ttlEvictorType="LAST_ACCESS_TIME" timeToLive="2700" /> <backingMap name="pessimisticMap" readOnly="false" pluginCollectionRef="pessimisticMap" preloadMode="false" lockStrategy="PESSIMISTIC" copyMode="COPY_ON_READ_AND_COMMIT" ttlEvictorType="LAST_ACCESS_TIME" timeToLive="2700" /> <backingMap name="excludedMap1" readOnly="false" pluginCollectionRef="excludedMap1" preloadMode="false" lockStrategy="OPTIMISTIC" copyMode="COPY_ON_READ_AND_COMMIT" ttlEvictorType="LAST_ACCESS_TIME" timeToLive="2700" /> <backingMap name="excludedMap2" readOnly="false" pluginCollectionRef="excludedMap2" preloadMode="false" lockStrategy="OPTIMISTIC" copyMode="COPY_ON_READ_AND_COMMIT" ttlEvictorType="LAST_ACCESS_TIME" timeToLive="2700" /> </objectGrid> </objectGrids> <backingMapPluginCollections> <backingMapPluginCollection id="agent"> <bean id="ObjectTransformer" className="com.ibm.ws.objectgrid.test.scenario.AgentObjectTransformer" /> </backingMapPluginCollection> <backingMapPluginCollection id="profile"> <bean id="ObjectTransformer" className="com.ibm.ws.objectgrid.test.scenario.ProfileObjectTransformer" /> <bean id="Evictor" className="com.ibm.websphere.objectgrid.plugins.builtins.LRUEvictor"> <property name="maxSize" type="int" value="2000" description="set max size for LRU evictor" /> <property name="sleepTime" type="int" value="15" description="evictor thread sleep time" /> <property name="numberOfLRUQueues" type="int" value="50" description="set number of LRU queues" /> </bean> </backingMapPluginCollection> <backingMapPluginCollection id="pessimisticMap" /> <backingMapPluginCollection id="excludedMap1" /> <backingMapPluginCollection id="excludedMap2" /> </backingMapPluginCollections> </objectGridConfig>
dual-roles model XML example <?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="AgentObjectGrid"> <bean id="ObjectGridEventListener" className="com.ibm.websphere.objectgrid.plugins.builtins.JMSObjectGridEventListener"> <property name="invalidationModel" type="java.lang.String" value="CLIENT_AS_DUAL_ROLES_MODEL" description="" /> <property name="invalidationStrategy" type="java.lang.String" value="PUSH" description="" /> <property name="mapsToPublish" type="java.lang.String" value="agent;profile;pessimisticMap" description="" /> <property name="jms_topicConnectionFactoryJndiName" type="java.lang.String" value="defaultTCF" description="" /> <property name="jms_topicJndiName" type="java.lang.String" value="defaultTopic" description="" /> <property name="jms_topicName" type="java.lang.String" value="defaultTopic" description="" /> <property name="jms_userid" type="java.lang.String" value="" description="" /> <property name="jms_password" type="java.lang.String" value="" description="" /> <property name="jndi_properties" type="java.lang.String" value="java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory;java.naming.provider.url= tcp://localhost:61616;connectionFactoryNames=defaultTCF;topic.defaultTopic=defaultTopic" description="jndi properties" /> </bean> <backingMap name="agent" readOnly="false" pluginCollectionRef="agent" preloadMode="false" lockStrategy="OPTIMISTIC" copyMode="COPY_ON_READ_AND_COMMIT" ttlEvictorType="LAST_ACCESS_TIME" timeToLive="28800" /> <backingMap name="profile" readOnly="false" pluginCollectionRef="profile" preloadMode="false" lockStrategy="OPTIMISTIC" copyMode="COPY_ON_READ_AND_COMMIT" ttlEvictorType="LAST_ACCESS_TIME" timeToLive="2700" /> <backingMap name="pessimisticMap" readOnly="false" pluginCollectionRef="pessimisticMap" preloadMode="false" lockStrategy="PESSIMISTIC" copyMode="COPY_ON_READ_AND_COMMIT" ttlEvictorType="LAST_ACCESS_TIME" timeToLive="2700" /> <backingMap name="excludedMap1" readOnly="false" pluginCollectionRef="excludedMap1" preloadMode="false" lockStrategy="OPTIMISTIC" copyMode="COPY_ON_READ_AND_COMMIT" ttlEvictorType="LAST_ACCESS_TIME" timeToLive="2700" /> <backingMap name="excludedMap2" readOnly="false" pluginCollectionRef="excludedMap2" preloadMode="false" lockStrategy="OPTIMISTIC" copyMode="COPY_ON_READ_AND_COMMIT" ttlEvictorType="LAST_ACCESS_TIME" timeToLive="2700" /> </objectGrid> </objectGrids> <backingMapPluginCollections> <backingMapPluginCollection id="agent"> <bean id="ObjectTransformer" className="com.ibm.ws.objectgrid.test.scenario.AgentObjectTransformer" /> </backingMapPluginCollection> <backingMapPluginCollection id="profile"> <bean id="ObjectTransformer" className="com.ibm.ws.objectgrid.test.scenario.ProfileObjectTransformer" /> <bean id="Evictor" className="com.ibm.websphere.objectgrid.plugins.builtins.LRUEvictor"> <property name="maxSize" type="int" value="2000" description="set max size for LRU evictor" /> <property name="sleepTime" type="int" value="15" description="evictor thread sleep time" /> <property name="numberOfLRUQueues" type="int" value="50" description="set number of LRU queues" /> </bean> </backingMapPluginCollection> <backingMapPluginCollection id="pessimisticMap" /> <backingMapPluginCollection id="excludedMap1" /> <backingMapPluginCollection id="excludedMap2" /> </backingMapPluginCollections> </objectGridConfig>