Liferay Clustering with RMI
In this tutorial, we will do cache replication with RMI technique.
- RMI is default EHCache replication implementation method and uses over TCP protocol. RMICacheManagerPeerListenerFactory distribution mechanism is configured by default in hibernate-cluster.xml and liferay-multi-vm.xml files.
-
<cacheManagerPeerListenerFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory" />
-
- Cluster node opens point to point connection to each individual server
- In RMI, each cached object must be serialized object
- Let’s say, we have 5 node cluster; Node1 will open four TCP connections against to other four nodes, with this huge number of connections, it will create lot of internal traffic may lead to performance issues.
- It’s always recommended to use RMI in two node cluster only
- Instead of RMI, use JGroups cluster with UDP or Cluster Link as explained in this tutorials
- Liferay Clustering with cluster link. click here to access the complete tutorial
- Liferay Clustering with jGroup. click here to access the complete tutorial
- In some of cloud environments such as AWS, doesn’t support UDP. In this case use uni cast cluster configuration
Liferay Clustering with RMI
- Create folder myehcache in ROOT\WEB-INF\classes and copy ehcache/hibernateclustered.Xml and liferay-multi-vmclustered. Xml files into that folder. This is step is necessary if you are not using ehcache plugin.
- Download ehcache folder that contains hibernate-clustered.xml and liferay-multi-vm files. Click here to download
add below in portal-ext.properties :-
net.sf.ehcache.configurationResourceName=/myehcache/hibernateclustered.xml ehcache.multi.vm.config.location=/myehcache/liferay-multi-vmclustered.xml net.sf.ehcache.configurationResourceName.peerProviderProperties=peerDiscovery=automatic,multicastGroupAddress=234.0.0.10 ,multicastGroupPort=25525,timeToLive=1 ehcache.multi.vm.config.location.peerProviderProperties=peerDiscovery=automatic,multicastGroupAddress=234.0.0.11,multicastGroupPort=25526,timeToLive=1 ## This property is to display node information on Liferay Page ### web.server.display.node=true lucene.replicate.write=true
-
- Please note this multi cast group IP is not used by any other server
- Now delete tables prefixed with “Quartz” and start the all servers; with this, we completed Liferay cache cluster setup with RMI.
Note: We are overriding default hibernate & multi vm xml files with myehcache folder to fine tune such as increasing disk memory for some entities like that. Its always best practice to keep these custom files and also it is not mandatory to provide peer provider properties in portal-ext.properties, rather we can add them in propertySeparator attribute in both xml files.
liferay-mutti-vm-cluter.xml :
<cacheManagerPeerProviderFactory class="com.liferay.portal.cache.ehcache.LiferayCacheManagerPeerProviderFactory" properties="portalPropertyKey=ehcache.multi.vm.config.location.peerProviderProperties" propertySeparator="," />
hibernate-cluster.xml:
<cacheManagerPeerProviderFactory class="com.liferay.portal.cache.ehcache.LiferayCacheManagerPeerProviderFactory" properties="portalPropertyKey=net.sf.ehcache.configurationResourceName.peerProviderProperties" propertySeparator="," />
Thanks…
Liferay Cluster with cluster link
In this tutorial we will look into Liferay Cluster setup on Liferay 6.2 EE version with cluster link.READ MORE
Liferay Cache Replication With JGroups
Liferay Cache Replication with JGroups tutorial will give you details on “How to setup cache replication with JGroups” READ MORE