5 Replies Latest reply on Mar 5, 2008 2:56 PM by meyers79

    Clustered Connection Factories

    tim.shaw

      JBoss 4.2.2.GA + JBM 1.4.0 SP1

      From connection-factories-service.xml :

      <!-- A clustered connection factory that supports automatic failover and load balancing of created
      connections.
      This factory is not suitable to be used by MDBs.
      -->

      I am trying to get a load-balanced cluster working (single client producing upwards of 200000 tasks for the cluster to perform via MDB's), and I can only get one of the cluster members (non-determinate) to service the incoming messages..

      Why is this factory not suitable for MDB's?
      Is there an example of one which is suitable?
      Does anyone have a simple (working) example of this sort of scenario that I can work from?

      Installation and examples all work fine BTW

      Thanks

      tim



        • 1. Re: Clustered Connection Factories
          pache

          From my understanding, load-balancing is not suitable because a MDB open several session, and you expect them to be connected to the same node.

          (dont ask me about the best factory to use :))

          • 2. Re: Clustered Connection Factories
            timfox

            If you use a connection factory with connection load balancing, this means that subsequent connections created with that factory will be made to different nodes in the cluster, in a round-robin fashion.

            Typically with MDBs, you deploy the MDB on every node of the cluster, in a homogenous fashion, the MDBs then consume from the local clustered queue which you've also deployed on each node in the cluster.

            So, you want the MDB on node A to consume from the clustered queue instance on node A, and you want the MDB instance on node B to consume from the clustered queue instance on node B. I.e. you want each MDB to consume from its local queue instance.

            If you were to use a connection factory with load balancing = true for the MDB on node A to create its connection to the queue, then subsequent connections would actually make connections to the queue instance on different nodes, but you always want it to connect to the local queue instance to minimise network traffic between servers.

            That's why it doesn't normally make sense to enable connection load balancing for MDBs.

            Hope that helps.

            • 3. Re: Clustered Connection Factories
              paduffy

              Similar question. My application structure is as follows:

              - Several dozen clients issue requests into a well know Q in AS instance CENTRAL (basically a message router).

              - MDB in CENTRAL performs routing based on message properties. Request is then placed on topic maintained in AS instance CENTRAL.

              - Several hundred (geo distributed) AS instance EDGE each have MDB listening to the remote topic maintained in CENTRAL. They decide to accept a messsage via the selector they apply to the remote topic.

              The idea is that internal messaging in EDGE must continue to function when CENTRAL is down. Thus the broker in CENTRAL performing the routing function, and the independent brokers in each EDGE.

              So my question is what is the recommended strategy to acheive HA at instance CENTRAL (the routing function). We were considering a clustered pair of CENTRAL. Clients connecting to CENTRAL would use a clustered connection to submit requests into the system. But what about the MDBs listening in EDGE?

              • 4. Re: Clustered Connection Factories
                timfox

                Well, you _could_ have multiple MDBs consuming from a single live JMS server - this is the old JBoss MQ style approach where you only have one active server in the cluster at any one time, nothing is stopping you from doing that if you want.

                Alternatively just have MDBs always consuming from their local servers, use clustered destinations, and message bridge to route messages between geographically distributed clustered (e.g. over WANs).

                • 5. Re: Clustered Connection Factories
                  meyers79

                  We have been struggling with this for some time and I am hoping that someone can help shed some light.

                  Are current architecture is as follows:

                  A clustered pair of JBA 4.2 servers serving up UI code

                  * Publishers on the UI nodes post messages to be picked up by batch nodes

                  A clustered pair of JBM 1.4 servers

                  * hosting 1 clustered queue


                  A clustered pair of JBA 4.2 servers serving as backend processing servers (batch nodes).

                  * Consumers (MDB'S) listen on remote queue to receive messages from the UI nodes.

                  Currently using the clustered connection factory (load balancing set true) to get a connection and post messages to the messaging nodes, we were expecting to see the messages sent to the queue from the UI nodes to be evenly distributed across both JBM nodes in a round robin fashion.



                  What we have observed

                  1. Messages appear to be round robin when both messaging nodes have an equal amount of Consumers.

                  2. If one node has no Consumers it appears messages are not sent to that node.



                  (No problems here assuming consumers get balanced)



                  When subscribing we use MDB's that also use the clustered connection factory, and expect that consumers will balanced across the

                  Cluster in a round robin-fashion.



                  1. The behavior here appears completely inconsistent. We have run many test cases and have not seen this round-robin.

                  Most of the time we will have two consumers land on the same node, and no consumers on the other.



                  2. With consumers not evenly distributed it appears the messages all get sent to the one node with consumers attached

                  and thus load is not evenly distributed (1 messaging server doing all the work).



                  3. It is also observed that not both consumers process incoming messages. Once we bring down consumers which was currently active, Inactive consumer will start picking up message after certain time delay.



                  Note that we use clustered Connection Factory and lookup using JNDI lookup specifying java.naming.provider.url as jnp://msgNode1:1100, jnp://msgNode2:1100 where msgNode1 and msgNode2 are IPs of two messaging nodes part of same message cluster



                  Is this expected behavior? Are others running this type of configuration successfully?



                  Per the comments in the previous post it appears most run there MDB's in the same JVM as the JMS provider.

                  This is not the case in our implementation, and I have struggled trying to find a working example of this.