You are here

Configuring Hazelcast between Share instances

This section describes the configuration of Hazelcast clustering between instances of Share.

In a load balanced environment, Alfresco Share now uses Hazelcast to provide multicast messaging between the web-tier nodes. As a result, Share caches no longer need to be disabled for any node, simple cache invalidation message are sent to all nodes when appropriate. Each node functions practically as fast as a single Share instance, enhancing the overall performance of Share.

To enable Hazelcast clustering between Share instances, configure the custom-slingshot-application-context.xml file found at < TOMCAT-HOME>/shared/classes/alfresco/web-extension. This file is used to override the Spring application context beans for Share.
Note: An example custom-slingshot-application-context.xml.sample file is provided in the Alfresco distribution, which now includes this configuration.
To enable the Hazelcast cluster messaging, edit this section on each Share Tomcat instance:
     Hazelcast distributed messaging configuration - Share web-tier cluster config (3.4.8 and 4.0.1)
     - see
     - and specifically 
<!-- Configure cluster to use either Multicast or direct TCP-IP messaging - multicast is default -->
<!-- Optionally specify network interfaces - server machines likely to have more than one interface -->
<!-- The messaging topic - the "name" is also used by the persister config below -->
<hz:topic id="topic" instance-ref="webframework.cluster.slingshot" name="slingshot-topic"/>
<hz:hazelcast id="webframework.cluster.slingshot">
      <hz:group name="slingshot" password="alfresco"/>
      <hz:network port="5801" port-auto-increment="true">
            <hz:multicast enabled="true"
            <hz:tcp-ip enabled="false">
         <hz:interfaces enabled="false">

<bean id="webframework.slingshot.persister.remote" class="" parent="webframework.sitedata.persister.abstract">
   <property name="store" ref="" />
   <property name="pathPrefix"><value>alfresco/site-data/${objectTypeIds}</value></property>
   <property name="hazelcastInstance" ref="webframework.cluster.slingshot" />
   <property name="hazelcastTopicName"><value>slingshot-topic</value></property>

<bean id="webframework.factory.requestcontext.servlet" class="" parent="webframework.factory.base">
   <property name="linkBuilderFactory" ref="webframework.factory.linkbuilder.servlet" />
   <property name="extensibilityModuleHandler" ref="webscripts.extensibility.handler" />
   <property name="dependencyHandler" ref="dependency.handler" />
   <property name="clusterObjectPersister" ref="webframework.slingshot.persister.remote" />

This configuration enables the Hazelcast Spring integration, which in turn, starts the Hazelcast server. The Hazelcast server is easily configurable and can use either multicast (default) or TCP-IP direct, if preferred. For more information, see the Hazelcast Documentation.

If this configuration is enabled, the Share instance becomes a cluster node and Hazelcast is started. If this configuration is disabled (such as, for a default install), then Hazelcast is not started. While using Share, only when any of the following actions occur, the cache invalidation messages will be sent from the affected node to other nodes in the cluster:
  • an existing site/user dashboard layout is modified
  • new site or user dashboard is created
  • runtime application properties are changed
Note: For activating the default set up, apply identical configuration to each Share node.

The following is a sample output that you get when you start Share:

INFO: / [slingshot] Hazelcast (20120105) starting at Address[]
19-Jan-2012 13:58:57 com.hazelcast.system
INFO: / [slingshot] Copyright (C) 2008-2011
19-Jan-2012 13:58:57 com.hazelcast.impl.LifecycleServiceImpl
INFO: / [slingshot] Address[] is STARTING
19-Jan-2012 13:58:59 com.hazelcast.impl.MulticastJoiner
INFO: / [slingshot]
Members [1] {
        Member [] this
19-Jan-2012 13:58:59
INFO: / [slingshot] Hazelcast Management Center started at port 5901.
19-Jan-2012 13:58:59 com.hazelcast.impl.LifecycleServiceImpl
INFO: / [slingshot] Address[] is STARTED
The above message shows that the configuration has successfully initialized Hazelcast between Share instances.