activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nizarkais <>
Subject understanding the Load balancing of the Master/Slave shared store topology
Date Wed, 02 Nov 2011 11:44:14 GMT
in our Company we have the requirement of setting up a high available
Cluster of JMS Brokers which would be connected to an ESB in order to
maintain async calls.

upon studying the requirements we came up with the following Cluster
topology to cover our requirement.
In general it is a Master/Slave Topology using a shared File System and a
static client discovery. For maintenance and operation issues e.g. OS or HW
updates of these the Nodes/Servers the Fail-over should also work properly.

*Server side Setup / Topology*:
3 Server Node on which one Master and one Slave are running.
The messages are being persisted via the KahaDb which writes in a shared
storage. The shared storage is mounted (probabley not recommended) via
NFS.V4 and we know the issues about NFS.
Each Master writes on its Folder. The Slave writes on the Folder of its
No Network connectors or discovery are configured between the servers, so
each is running as a stand-alone server.
When running/Starting the Cluster we first start the Masters and that their
Once a Master is started it creates the LOCK of the shared storage and the
Slave waits till this lock ist gone, so it can start and create its LOCK.
The NFS.V4 Mount is not making any troubles till now, it could be slow but
for our initial purpose it is covering our requirements.  
*Therefore see

*Client Side / Message Producer*:
The Connection factory connects to a composite of 3 Failover networks as a
static list of the Server IPs using the TCP protocol and 
Each netowrk consists of one Master and to slaves where the randomization is
The final composite consists of three such networks where the randomization
is enabled. 
See therefore this image:

*The activemq.xml:*

        <property name="locations">

    <broker xmlns=""
brokerName="mastera" dataDirectory="${activemq.base}/data/"

                <policyEntry topic=">" producerFlowControl="true"
                    <vmCursor />
                <policyEntry queue=">" producerFlowControl="true"

            <kahaDB directory="/nfsv4/storage1/kahadb"/>
            <transportConnector name="openwire" uri="tcp://master1:61616"/>

    <import resource="jetty.xml"/>

*The Producer test code:*
String network1 =
      String network2 =
      String network3 =

        ConnectionFactory connectionFactory = new
        		+ "failover:(" + network1 + "," + network2 + "," + network3 +
        		+ "failover:(" + network2 + "," + network3 + "," + network1 +
        		+ "failover:(" + network3 + "," + network1 + "," + network2+
                + ")?randomize=true");
        Connection connection;
        try {
            connection = connectionFactory.createConnection();
            Session session = connection.createSession(false,
            Destination destination = session.createQueue(subject);

            MessageProducer producer = session.createProducer(destination);

            for (int i = 0; i < 300000; i++) {
                TextMessage message = session.createTextMessage("Hello msg "
+ i);
        } catch (JMSException e) {

*Why the conncetionFactory looks like this:*
 ConnectionFactory connectionFactory = new
        		+ "failover:(" + network1 + "," + network2 + "," + network3 +
        		+ "failover:(" + network2 + "," + network3 + "," + network1 +
        		+ "failover:(" + network3 + "," + network1 + "," + network2+
                + ")?randomize=true");
+ whithin each Failover config (e.g. network1 + network2 + network3) the
randomization is turned off to always begin with this order to achieve the
real Failover scenario.
+ Over these Failovers the randomization is enabled in order to achieve the
client side load balancing.

* The questions we have:*
+ is this ok? correct? 
+ do you have better options for Load balancing?

Thanks in Advance
Nizar Kais

View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message