Using JDG as External Cache Container for WildFly HTTP Session Replication: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 40: Line 40:


<font color=red>Do I want to create a new cache-container? The documentation seems to suggest so.</font>
<font color=red>Do I want to create a new cache-container? The documentation seems to suggest so.</font>
<pre>
<cache-container name="cacheContainer" default-cache="default-cache" module="org.jboss.as.clustering.web.infinispan" statistics-enabled="true">
    <transport lock-timeout="60000"/>
    <replicated-cache name="default-cache" mode="SYNC" batching="true">
      <remote-store cache="default" socket-timeout="60000" preload="true" passivation="false" purge="false" shared="true">
        <remote-server outbound-socket-binding="remote-jdg-server1"/>
        <remote-server outbound-socket-binding="remote-jdg-server2"/>
      </remote-store>
    </replicated-cache>
  </cache-container>
</pre>
<pre>
<distributed-cache name="default" mode="SYNC" owners="2" remote-timeout="30000" start="EAGER">
    <remote-store cache="default" socket-timeout="60000" tcp-no-delay="true" fetch-state="false" preload="true" purge="false" shared="true">
        <remote-server outbound-socket-binding="remote-store-hotrod-server"/>
    </remote-store>
</distributed-cache>
</pre>

Revision as of 01:04, 1 June 2016

External

Internal

Relevance

  • EAP 6.5, JDG 6.6

Overview

JDG can be used as an external cache container for HTTP session data within WildFly. This allows scaling of the data layer independent of the application, and enables different WildFly clusters, that may reside in various domains, to access data from the same JDG cluster.

Setup the JDG Cluster

Configuration details are available here: Infinispan Configuration. The external JDG cluster will be accessed by the WildFly instance over the HotRod protocol.

Define a dedicated cache for each web application In this specific case, the dedicated cache name is "http-sessions":

<subsystem xmlns="urn:infinispan:server:core:6.4">
  <cache-container name="clustered" default-cache="default" statistics="true">
    <transport executor="infinispan-transport" lock-timeout="60000"/>
    <distributed-cache name="default" ...>
      ...
    </distributed-cache>
    <distributed-cache name="http-sessions" owners="2" mode="SYNC" start="EAGER"/>
  </cache-container>
  ...
</subsystem>

Create a new WildFly Cache

For each distributable application, an entirely new WildFly cache must be created. It can be created in an existing cache container, for example, "web".

Do I want to create a new cache-container? The documentation seems to suggest so.

<cache-container name="cacheContainer" default-cache="default-cache" module="org.jboss.as.clustering.web.infinispan" statistics-enabled="true">
    <transport lock-timeout="60000"/>
    <replicated-cache name="default-cache" mode="SYNC" batching="true">
      <remote-store cache="default" socket-timeout="60000" preload="true" passivation="false" purge="false" shared="true">
        <remote-server outbound-socket-binding="remote-jdg-server1"/>
        <remote-server outbound-socket-binding="remote-jdg-server2"/>
      </remote-store>
    </replicated-cache>
  </cache-container>
<distributed-cache name="default" mode="SYNC" owners="2" remote-timeout="30000" start="EAGER">
    <remote-store cache="default" socket-timeout="60000" tcp-no-delay="true" fetch-state="false" preload="true" purge="false" shared="true">
        <remote-server outbound-socket-binding="remote-store-hotrod-server"/>
    </remote-store>
</distributed-cache>