Chapter 6. Cache Modes
Red Hat JBoss Data Grid provides two modes:
- Local mode is the only non-clustered cache mode offered in JBoss Data Grid. In local mode, JBoss Data Grid operates as a simple single-node in-memory data cache. Local mode is most effective when scalability and failover are not required and provides high performance in comparison with clustered modes.
- Clustered mode replicates state changes to a small subset of nodes. The subset size is sufficient for fault tolerance purposes but not large enough to hinder scalability. Before attempting to use clustered mode, it is important to first configure JGroups for a clustered configuration. For details about configuring JGroups, see Section 26.2, “Configure JGroups (Library Mode)”
6.1. About Cache Containers
Cache containers are used in Red Hat JBoss Data Grid's Remote Client-Server mode as a starting point for a cache. The
cache-container
element acts as a parent of one or more (local or clustered) caches. To add clustered caches to the container, transport must be defined.
The following procedure demonstrates a sample cache container configuration:
Procedure 6.1. How to Configure the Cache Container
Specify the Cache Container
Thecache-container
element specifies information about the cache container using the following parameters:<subsystem xmlns="urn:infinispan:server:core:6.1" default-cache-container="default">
Set the Cache Container Name
Thename
parameter defines the name of the cache container.<subsystem xmlns="urn:infinispan:server:core:6.1" default-cache-container="default"> <cache-container name="default" />
Specify the Default Cache
Thedefault-cache
parameter defines the name of the default cache used with the cache container.<subsystem xmlns="urn:infinispan:server:core:6.1" default-cache-container="default"> <cache-container name="default" default-cache="default" />
Enable/Disable Statistics
Thestatistics
attribute is optional and istrue
by default. Statistics are useful in monitoring JBoss Data Grid via JMX or JBoss Operations Network, however they adversely affect performance. Disable this attribute by setting it tofalse
if it is not required.<subsystem xmlns="urn:infinispan:server:core:6.1" default-cache-container="default"> <cache-container name="default" default-cache="default" statistics="true"/>
Define the Listener Executor
Thelistener-executor
defines the executor used for asynchronous cache listener notifications.<subsystem xmlns="urn:infinispan:server:core:6.1" default-cache-container="default"> <cache-container name="default" default-cache="default" statistics="true" listener-executor="infinispan-listener" />
Set the Cache Container Start Mode
Thestart
parameter indicates when the cache container starts, i.e. whether it will start lazily when requested or "eagerly" when the server starts up. Valid values for this parameter areEAGER
andLAZY
.<subsystem xmlns="urn:infinispan:server:core:6.1" default-cache-container="default"> <cache-container name="default" default-cache="default" statistics="true" listener-executor="infinispan-listener" start="EAGER">
Per-cache Statistics
Ifstatistics
are enabled at the container level, per-cache statistics can be selectively disabled for caches that do not require monitoring by setting thestatistics
attribute tofalse
.<subsystem xmlns="urn:infinispan:server:core:6.1" default-cache-container="default"> <cache-container name="default" default-cache="default" statistics="true" listener-executor="infinispan-listener" start="EAGER"> <local-cache name="default" statistics="true"> ... </local-cache> </cache-container> </subsystem>