WebSphere eXtreme Scale Administration Guide > Configure WebSphere eXtreme Scale > WebSphere eXtreme Scale client configuration
Enable the client invalidation mechanism
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.
Near cache
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.
Two models are available for the client invalidation mechanism in a distributed eXtreme Scale environment:
- Client-server model: In this model, all server processes are in a publisher role that publishes all the transaction changes to the designated JMS destination. All client processes are in receiver roles and receive all transactional changes from the designated JMS destination.
- Client as dual roles model: In this model, all server processes have nothing to do with the JMS destination. All client processes are both JMS publisher and receiver roles. Transactional changes that occur on the client are published to the JMS destination and all the clients receive these transactional changes.
For more information, read about the JMS event listener.
Client-server model
In a client-server model, the servers are in a JMS publisher role and the client is in JMS receiver role.
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>
Client as dual roles model
In client as dual roles model, each client has both JMS publisher and receiver roles. The client publishes every committed transactional change to a designated JMS destination and receives all the committed transactional changes from other clients. The server has nothing to do with JMS in this model.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>
Parent topic
WebSphere eXtreme Scale client configuration