AnsweredAssumed Answered

EHCache Replication using JGroups over TCP ?

Question asked by deepak1987 on Oct 11, 2012
Latest reply on Nov 16, 2012 by jspuchau
What is the difference between Default EHCache Replication using JGroups over TCP protocol and Alfresco's implemenation for EHCache Replication using JGroups over TCP protocol ?


I mean to say,
In alfresco-global.properties file,  I have configured JGroups for Ehcache Replication using TCP protocol:


alfresco.cluster.name = alfrescocluster
alfresco.jgroups.defaultProtocol = TCP
alfresco.tcp.initial_hosts = host_1[7800],host_2[7800]
alfresco.jgroups.bind_address = host_1
alfresco.tcp.start_port = 7800

and

In ehcache-custom.xml file,
1) CacheManagerPeerProviderFactory class is org.alfresco.repo.cache.AlfrescoCacheManagerPeerProviderFactory.
2) CacheManagerPeerListenerFactory class is net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory.
3) CacheEventListenerFactory class is net.sf.ehcache.distribution.RMICacheReplicatorFactory.


<cacheManagerPeerProviderFactory
         class="org.alfresco.repo.cache.AlfrescoCacheManagerPeerProviderFactory"
         properties="heartbeatInterval=5000,
                          peerDiscovery=automatic,
                          multicastGroupAddress=230.0.0.1,
                          multicastGroupPort=4446"
/>

<cacheManagerPeerListenerFactory
                                  class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
                                  properties="socketTimeoutMillis=10000"
/>

<defaultCache
       …
   >
             <cacheEventListenerFactory
                         class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
                          properties="replicatePuts = false,
                                replicateUpdates = true,
                                replicateRemovals = true,
                                replicateUpdatesViaCopy = false,
                                replicateAsynchronously = false"/>
</defaultCache>


If I use default classes of Ehcache for replication using JGroups over TCP
as
1) CacheManagerPeerProviderFactory = net.sf.ehcache.distribution.jgroups.JGroupsCacheManagerPeerProviderFactory.
2) CacheEventListenerFactory = net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory.

I have got the following configuration from
http://www.ehcache.org/documentation/replication/jgroups-replicated-caching#example-configuration-using-tcp-unicast

 
<cacheManagerPeerProviderFactory
          class="net.sf.ehcache.distribution.jgroups.JGroupsCacheManagerPeerProviderFactory"
          properties="connect=TCP(bind_port=7800):
                            TCPPING(initial_hosts=host_1[7800],host_2[7800];port_range=10;timeout=3000;
                                          num_initial_members=3):
                            VERIFY_SUSPECT(timeout=1500):
                            pbcast.NAKACK(retransmit_timeout=3000):
                            pbcast.GMS(join_timeout=5000;print_local_addr=false)" 
           propertySeparator="::"
/>

<defaultCache
             ….
         > 
            <cacheEventListenerFactory
                       class="net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory"
                       properties="replicatePuts = false,
                                         replicateUpdates = true,
                                         replicateRemovals = true,
                                         replicateUpdatesViaCopy = false,
                                         replicateAsynchronously = false" />

</defaultCache>


Will it impact on performance while replicating caches on nodes in a cluster??
If YES then, how and why ?

I tried with above configuration using Default implementation of Ehcache instead of Alfresco's method and did testing by following instructions in https://wiki.alfresco.com/wiki/Cluster_Configuration_V2.1.3_and_Later#Testing_the_cluster. It worked, but not sure about pros and cons.

Has anybody tried or did such kind of experiment??

Your inputs are highly appreciated.

Outcomes