Session replication in Weblogic Cluster

Ratings:
(4)
Views: 0
Banner-Img
Share this blog:

Replicating session in JBoss 

In this tutorial, we will see how to do Session replication in Weblogic Cluster You now need to use the node1 and node2 created before In session-test.war/WEB-INF/web.xml, add:

  <web-app>

  <display-name>Session Test</display-name>

  <description>...</description>

  <distributable/> <!--  -->

  ...

</web-app>

Your application’s HTTP sessions now use the distributed cache.

Now:

  • Disable sticky sessions (optional)
  • Redeploy session-test.war to node1/deploy and node2/deploy directories
  • Restart and retest You can now see that your application is fault-tolerant, it supports failover AND state replication Problems with sticky sessions?
  • Uneven distribution of load
  • If one instance goes down, all of its sessions go with it

You can configure session replication here:

  • Sessions are replicated by all/deploy/cluster/jboss-cache-manager.sar:
  • Cache Mode: REPL_SYNC, REPL_ASYNC
  • Caching Configuration: replication queue
  • Cluster Name and Configuration: communication

Inclined to build a profession as JBoss Developer? Then here is the blog post on, explore JBoss Training

  • Configure session replication per app in WEB-INF/jboss-web.xml

Replication trigger: SET, SET_AND_GET, SET_AND_NON_PRIMITIVE_GET, ACCESS

Replication granularity: SESSION, ATTRIBUTE, FIELD

deploy/cluster/jboss-cache-manager.sar/META-INF/jboss-cache-manager-jboss-beans.xml:

<deployment ...>

  ...

 <bean name="CacheConfigurationRegistry" ...>

  ...

 <property name="newConfigurations">

  <map keyClass="java.lang.String" valueClass="org.jboss.cache.config.Configuration">

  <entry><key>standard-session-cache</key>

   <value>

   <bean name="StandardSessionCacheConfig" class="org.jboss.cache.config.Configuration">

    ...

   <property name="clusterName">${jboss.partition.name:DefaultPartition}-SessionCache</property>

    <property name="multiplexerStack">${jboss.default.jgroups.stack:udp}</property>

    <property name="fetchInMemoryState">true</property>

    <property name="nodeLockingScheme">PESSIMISTIC</property>

    <property name="isolationLevel">REPEATABLE_READ</property>

     <property name="useLockStriping">false</property>

     <property name="cacheMode">REPL_ASYNC</property>

     <property name="syncReplTimeout">17500</property>

     <property name="lockAcquisitionTimeout">15000</property>

       ...

     </bean>

     </value>

     </entry>

     ...

    </map>

    </property>

    ...

   </bean>

   ...

   </deployment>

You can also specify for each application some parameters: WEB-INF/jboss-web.xml:

<jboss-web>

 <replication-config>

 <replication-trigger>SET_AND_NON_PRIMITIVE_GET</replication-trigger>

 <replication-granularity>SESSION</replication-granularity>

 </replication-config>

 </jboss-web>

You liked the article?

Like: 0

Vote for difficulty

Current difficulty (Avg): Medium

EasyMediumHardDifficultExpert
IMPROVE ARTICLEReport Issue

About Author

Authorlogo
Name
TekSlate
Author Bio

TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.