2.2.4.1. Infinispan configuration

Warning

You are looking at documentation for an older release. Not what you want? See the current release documentation.

This section will show you how to use and configure Infinispan in the clustered environment. Also, you will know how to use a template-based configuration offered by eXo JCR for Infinispan instances.

For indexer, lock manager and data container

Each mentioned components uses instances of Infinispan product for caching in clustered environment. So every element has its own transport and has to be configured in a proper way.

eXo JCR offers a template-based configuration for Infinispan instances. You can have one template for Lock Manager, one for Indexer and one for data container and use them in all the workspaces, defining the map of substitution parameters in a main configuration file. Just simply define ${infinispan-<parameter name>} inside xml-template and list correct value in JCR configuration file just below "infinispan-configuration", as shown:



            <jgroups transport="org.infinispan.remoting.transport.jgroups.JGroupsTransport">
    <stack-file name="stack" path="${jgroups-configuration}"/>
  </jgroups>
        

and JCR configuration file:



...
<property name="infinispan-configuration" value="conf/standalone/cluster/test-infinispan-lock.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
...
        

JGroups configuration

JGroups is used by Infinispan for network communications and transport in a clustered environment. If the property jgroups-configuration is defined in component configuration, it will be injected into the configuration of the Infinispan instance on startup.


<property name="jgroups-configuration" value="your/path/to/modified-udp.xml" />

To prevent having to deal with several different cluster name and to reduce the network overheads, it is now highly recommended to use the JGroups shared transport, to do so simply set the property singleton_name of your JGroups configuration to a unique name as below:



<config xmlns="urn:org:jgroups"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="urn:org:jgroups http://www.jgroups.org/schema/JGroups-3.2.xsd">
    <UDP
         singleton_name="JCR-cluster"
...
        

Shipped Infinispan configuration templates

eXo JCR implementation is shipped with ready-to-use Infinispan configuration templates for JCR's components. They are located in the application package inside the folder /conf/portal/cluster.

Data container template

Data container template is cache-config.xml:



<infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns="urn:infinispan:config:8.2"
            xsi:schemaLocation="urn:infinispan:config:8.2 http://www.infinispan.org/schemas/infinispan-config-8.2.xsd">
  <threads>
    <thread-factory name="infinispan-factory" group-name="infinispan" thread-name-pattern="%G %i" priority="5"/>

    <!-- listener-executor -->
    <blocking-bounded-queue-thread-pool name="infinispan-listener" thread-factory="infinispan-factory"
                                        core-threads="1" max-threads="5" queue-length="0" keepalive-time="0"/>
    <!-- expiration-executor -->
    <scheduled-thread-pool name="infinispan-expiration" thread-factory="infinispan-factory" />
  </threads>

  <jgroups transport="org.infinispan.remoting.transport.jgroups.JGroupsTransport">
    <stack-file name="stack" path="${exo.jcr.cluster.jgroups.config}"/>
  </jgroups>

  <cache-container name="jcr" default-cache="default" expiration-executor="infinispan-expiration"  listener-executor="infinispan-listener"
                   statistics="true">
    <jmx duplicate-domains="true" domain="jcr.ispn.cache" mbean-server-lookup="org.infinispan.jmx.PlatformMBeanServerLookup"/>
    <transport cluster="${exo.cluster.partition.name}-jcr" stack="stack" lock-timeout="240000"/>
    <replicated-cache-configuration mode="SYNC" name="default" statistics="true" remote-timeout="${exo.jcr.cluster.workspace.sync.repltimeout:240000}">
      <locking  isolation="READ_COMMITTED" concurrency-level="500" striping="false" write-skew="false" 
                acquire-timeout="${exo.jcr.workspace.lockacquisitiontimeout:180000}"/>
      <transaction locking="PESSIMISTIC"  mode="NON_XA" 
                    transaction-manager-lookup="org.exoplatform.services.transaction.infinispan.JBossStandaloneJTAManagerLookup" />
      <eviction size="${exo.jcr.workspace.eviction.maxEntries:1000000}" strategy="LIRS" thread-policy="DEFAULT"/>
      <state-transfer enabled="${exo.jcr.cluster.workspace.statetransfer.fetchinmemorystate:false}" 
                        timeout="${exo.jcr.cluster.workspace.statetransfer.timeout:240000}" />
      <expiration interval="${exo.jcr.workspace.expiration.wakeupinterval:60000}"/>
    </replicated-cache-configuration>
  </cache-container>
</infinispan>
VariableDescription
exo.jcr.cluster.jgroups.configThis is the path to JGroups configuration that should not be anymore jgroups' stack definitions but a normal jgroups configuration format with the shared transport configured by simply setting the jgroups property singleton_name to a unique name (it must remain unique from one portal container to another). This file is also pre-bundled with templates and is recommended for use.
{exo.cluster.partition.name}-jcrThis defines the name of the cluster. Needs to be the same for all nodes in a cluster in order to find each other.

Lock manager template

It's template name is lock-config.xml:



<infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns="urn:infinispan:config:8.2"
            xsi:schemaLocation="urn:infinispan:config:8.2 http://www.infinispan.org/schemas/infinispan-config-8.2.xsd">
  <threads>
    <thread-factory name="infinispan-factory" group-name="infinispan" thread-name-pattern="%G %i" priority="5"/>

    <!-- listener-executor -->
    <blocking-bounded-queue-thread-pool name="infinispan-listener" thread-factory="infinispan-factory" core-threads="1" 
                                        max-threads="5" queue-length="0" keepalive-time="0"/>
  </threads>

  <jgroups transport="org.infinispan.remoting.transport.jgroups.JGroupsTransport">
    <stack-file name="stack" path="${exo.jcr.cluster.jgroups.config}"/>
  </jgroups>

  <cache-container name="lock-manager"  default-cache="default"  listener-executor="infinispan-listener"
                   statistics="true">
    <jmx duplicate-domains="true" domain="jcr.ispn.cache" mbean-server-lookup="org.infinispan.jmx.PlatformMBeanServerLookup"/>
    <transport cluster="${exo.cluster.partition.name}-jcr-lock" stack="stack" lock-timeout="240000"/>
    <replicated-cache-configuration mode="SYNC" name="default" statistics="true" remote-timeout="${exo.jcr.cluster.lock.sync.repltimeout:240000}">
      <locking isolation="READ_COMMITTED" concurrency-level="500" striping="false" write-skew="false" 
                acquire-timeout="${exo.jcr.lock.lockacquisitiontimeout:180000}"/>
      <transaction transaction-manager-lookup="org.exoplatform.services.transaction.infinispan.JBossStandaloneJTAManagerLookup" mode="NON_XA"/>
      <state-transfer enabled="${exo.jcr.cluster.lock.statetransfer.fetchinmemorystate:false}" 
                        timeout="${exo.jcr.cluster.lock.statetransfer.timeout:240000}"/>
      <eviction strategy="NONE" />
      <expiration lifespan="-1" />
      <persistence passivation="false">
        <string-keyed-jdbc-store xmlns="urn:infinispan:config:store:jdbc:8.0" shared="true" fetch-state="true" 
                                read-only="false" purge="false" preload="true">
          <string-keyed-table drop-on-exit="${infinispan-cl-cache.jdbc.table.drop}" create-on-start="${infinispan-cl-cache.jdbc.table.create}"
                              prefix="${infinispan-cl-cache.jdbc.table.name}">
            <id-column name="${infinispan-cl-cache.jdbc.id.column}" type="${infinispan-cl-cache.jdbc.id.type}" />
            <data-column name="${infinispan-cl-cache.jdbc.data.column}" type="${infinispan-cl-cache.jdbc.data.type}" />
            <timestamp-column name="${infinispan-cl-cache.jdbc.timestamp.column}" type="${infinispan-cl-cache.jdbc.timestamp.type}" />
          </string-keyed-table>
        </string-keyed-jdbc-store>
      </persistence>
    </replicated-cache-configuration>
  </cache-container>
</infinispan>
    

Note

To prevent any consistency issue regarding the lock data please ensure that your cache store is org.exoplatform.services.jcr.infinispan.JdbcStringBasedCacheStore and that your database engine is transactional.

VariableDescription
exo.jcr.cluster.jgroups.configThis is the path to JGroups configuration that should not be anymore jgroups' stack definitions but a normal jgroups configuration format with the shared transport configured by simply setting the jgroups property singleton_name to a unique name (it must remain unique from one portal container to another). This file is also pre-bundled with templates and is recommended for use.
{exo.cluster.partition.name}-jcr-lockThis defines the name of the cluster. Needs to be the same for all nodes in a cluster in order to find each other.
infinispan-cl-cache.jdbc.table.nameThe table name.
infinispan-cl-cache.jdbc.id.columnThe name of the column id.
infinispan-cl-cache.jdbc.data.columnThe name of the column data.
infinispan-cl-cache.jdbc.timestamp.columnThe name of the column timestamp.
infinispan-cl-cache.jdbc.id.typeThe type of the column id.
infinispan-cl-cache.jdbc.data.typeThe type of the column data.
infinispan-cl-cache.jdbc.timestamp.typeThe type of the column timestamp.
infinispan-cl-cache.jdbc.table.dropCan be set to true or false. Indicates whether to drop the table at stop phase.
infinispan-cl-cache.jdbc.table.createCan be set to true or false. Indicates whether to create table at start phase. If true, the table is created if it does not already exist.

Query handler (indexer) template

Have a look at indexer-config.xml:



<infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns="urn:infinispan:config:8.2"
            xsi:schemaLocation="urn:infinispan:config:8.2 http://www.infinispan.org/schemas/infinispan-config-8.2.xsd">
  <threads>
    <thread-factory name="infinispan-factory" group-name="infinispan" thread-name-pattern="%G %i" priority="5"/>

    <!-- listener-executor -->
    <blocking-bounded-queue-thread-pool name="infinispan-listener" thread-factory="infinispan-factory"
                                        core-threads="1" max-threads="5" queue-length="0" keepalive-time="0"/>

    <!-- expiration-executor -->
    <scheduled-thread-pool name="infinispan-expiration" thread-factory="infinispan-factory" />
  </threads>

  <jgroups transport="org.infinispan.remoting.transport.jgroups.JGroupsTransport">
    <stack-file name="stack" path="${exo.jcr.cluster.jgroups.config}"/>
  </jgroups>

  <cache-container name="indexer"  default-cache="default" expiration-executor="infinispan-expiration"  listener-executor="infinispan-listener"
                   statistics="true">
    <jmx duplicate-domains="true" domain="jcr.ispn.cache" mbean-server-lookup="org.infinispan.jmx.PlatformMBeanServerLookup"/>
    <transport cluster="${exo.cluster.partition.name}-jcr-indexer" stack="stack" lock-timeout="240000"/>
    <replicated-cache-configuration mode="SYNC" name="default" statistics="true" >
      <eviction strategy="NONE"/>
      <transaction mode="NON_XA" transaction-manager-lookup="org.exoplatform.services.transaction.infinispan.JBossStandaloneJTAManagerLookup"/>
      <locking isolation="READ_COMMITTED" concurrency-level="500" striping="false" write-skew="false" 
                acquire-timeout="${exo.jcr.cluster.indexer.sync.repltimeout:180000}"/>
      <state-transfer enabled="${exo.jcr.cluster.indexer.statetransfer.fetchinmemorystate:false}" 
                        timeout="${exo.jcr.cluster.indexer.statetransfer.timeout:240000}" />
      <persistence passivation="false">
        <store class="${infinispan-cachestore-classname}" shared="false"  fetch-state="true" read-only="false" purge="false" preload="false"></store>
      </persistence>
    </replicated-cache-configuration>
  </cache-container>
</infinispan>
    
VariableDescription
exo.jcr.cluster.jgroups.configThis is the path to JGroups configuration that should not be anymore jgroups' stack definitions but a normal jgroups configuration format with the shared transport configured by simply setting the jgroups property singleton_name to a unique name (it must remain unique from one portal container to another). This file is also pre-bundled with templates and is recommended for use.
{exo.cluster.partition.name}-jcr-indexerThis defines the name of the cluster. Needs to be the same for all nodes in a cluster in order to find each other.
Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus