1 2 Previous Next 15 Replies Latest reply on Oct 14, 2005 12:05 PM by kiran222

    JBoss 4.0 JMS Cluster Support

    psrivas

      Can anyone explain to me how JBoss 4.0 supports cluster-wide JMS destinations? Will the getConnection method on a JMS connection factory load-balance between different nodes of the cluster? When a message is sent to a destination from the same session will it be load balanced across the different members of a destination? I haven't seen any documentation on the JMS clustering capabilities of JBoss 4.0. Any information would be appreciated.

        • 1. Re: JBoss 4.0 JMS Cluster Support


          Hhhhhhuhhhhhhh!!! I have been trying to find an answer for the last one week.
          So, I will post here whatever I could find so far:

          http://www.jboss.org/wiki/Wiki.jsp?page=JBossMQHA talks about an example that is capable of both Fail over and Load balancing. Fail over is ok. But, I did not get from the article what kind of load balancing I could get and how it can be achieved.

          Anyway, I used the example and successfully got the failover to work with 4.0.x. But, not the load balancing. Means, I could get the messages going to one or other cluster node. But, never to both.

          Let me know if you have already tried this and want to work on it together and figure it out and post an example for everybody.

          Thanks
          Kiran

          • 2. Re: JBoss 4.0 JMS Cluster Support
            razor_harm

            I don't think it is possible to load balance the queue itself. (Only the consumers). Adrian, correct me if I'm wrong here.

            Do you want to load balance the queue itself? Or can you live with load balancing the consumers? (I assume this is where the actual work get's done??)....

            • 3. Re: JBoss 4.0 JMS Cluster Support

              Thanks for your replies. I am still trying to make the example in http://www.jboss.org/wiki/Wiki.jsp?page=JBossMQHA work with JBoss 4.0.

              I don't mind whether the load balancing takes place in the Queues or at the Consumer(MDB) level.

              So this is my understanding now:

              In my scenario of a 2 node cluster, from a client, look up the Queue using the HAJNDI. So, you don't know the identity of the Node where the Queue is picked up from. Regard less, if you keep sending the JMS Messages to that Queue, the MDBs from both Nodes are going to receive the Messages. This is an automatic feature available using HAJNDI.

              Please confirm or clarify?

              Kiran

              • 4. Re: JBoss 4.0 JMS Cluster Support
                razor_harm

                 

                "kiran222" wrote:
                Thanks for your replies. I am still trying to make the example in http://www.jboss.org/wiki/Wiki.jsp?page=JBossMQHA work with JBoss 4.0.

                I don't mind whether the load balancing takes place in the Queues or at the Consumer(MDB) level.

                So this is my understanding now:

                In my scenario of a 2 node cluster, from a client, look up the Queue using the HAJNDI. So, you don't know the identity of the Node where the Queue is picked up from.


                Correct


                Regard less, if you keep sending the JMS Messages to that Queue, the MDBs from both Nodes are going to receive the Messages. This is an automatic feature available using HAJNDI.


                Not sure about this one... I have the following setup:

                (client) -----> (cluster HA-JMS queue) <-----(mdb consumers)

                Client (stand alone jboss instance) sends messages to my HA-JMS cluster, which now consists of two machines (two jboss instances). The cluster has the HA-JMS clustered queue deployed, and provides fail-over and load-balancing for my message consumers.

                My mdb consumers (which also live on a different machine and jboss instance) are looking up the queue using HA-JNDI so they have automatic fail-over and load-balancing (this is a feature of HA-JMS).

                Note that my MDB's are not on the same host as the clustered JMS queue. (I'm not sure if it would be of any use to use HA-JMS if they were on the same node).

                Regards,

                Harm


                • 5. Re: JBoss 4.0 JMS Cluster Support

                  Thanks a lot for your help. I got both fail over and load balancing to work on JBoss 4.0.

                  The setup (2 Node HA Cluster) I have tried is very similar to you except that I have MDBs on both the Nodes. It seems that the MDBs on the Master Node receive the messages first. And, then slowly when the message rate from the client is increased, the MDBs on the second Node started receiving the messages.


                  Note that my MDB's are not on the same host as the clustered JMS queue. (I'm not sure if it would be of any use to use HA-JMS if they were on the same node).


                  Why not? The Node (with JMS Queue) has the JBoss server running and available for processing. Why should not we use it?

                  If that Node (with JMS Queue) is to die, another instance of Queue will be made available on the other Node by the HAJNDI and that Queue will start taking the messages from the client. I verified that it is working.

                  One thing that still bugs me is: How does the load balancing work? In the scenario described above, what (criteria) triggers the messages to be delivered to the SDBs second Node?

                  Kiran


                  • 6. Re: JBoss 4.0 JMS Cluster Support

                    Correction of the last message:

                    One thing that still bugs me is: How does the load balancing work? In the scenario described above, what (criteria) triggers the messages to be delivered to the MDBs on the second Node?

                    Kiran

                    • 7. Re: JBoss 4.0 JMS Cluster Support
                      razor_harm

                       

                      "kiran222" wrote:

                      Why not? The Node (with JMS Queue) has the JBoss server running and available for processing. Why should not we use it?

                      If that Node (with JMS Queue) is to die, another instance of Queue will be made available on the other Node by the HAJNDI and that Queue will start taking the messages from the client. I verified that it is working.


                      Okay I can see your point... Just remember that when your node dies (machine crashes), you loose both the queue and a message consumer (processing power). This is the reason why we chose to deploy our consumers on separe JBoss instances.

                      "kiran222" wrote:
                      Correction of the last message:

                      One thing that still bugs me is: How does the load balancing work? In the scenario described above, what (criteria) triggers the messages to be delivered to the MDBs on the second Node?

                      Kiran


                      From the WIKI:

                      http://www.jboss.org/wiki/Wiki.jsp?page=JBossMQHA&version=32


                      Load-balanced, faul-tolerant MDBs in HAJMS

                      Load-balancing message processing with MDBs is a one of the best ways to distribute load across a cluster because the node with the least activity will process the message (as opposed to a round-robin load-balancing algorithm which could continue to place load on an already overloaded node).


                      So I guess the node with the least activity gets the message. (I think some kind of 'load' indicator exists in de clustered jboss-instances).

                      Does that help?




                      • 8. Re: JBoss 4.0 JMS Cluster Support
                        razor_harm

                         


                        Okay I can see your point... Just remember that when your node dies (machine crashes), you loose both the queue and a message consumer (processing power). This is the reason why we chose to deploy our consumers on separe JBoss instances.


                        small correction:
                        You don't loose the queue (you loose the queue on that jboss instance).

                        • 9. Re: JBoss 4.0 JMS Cluster Support

                          For completeness, since nobody answered the load balancing policy question:
                          http://www.jboss.org/wiki/Wiki.jsp?page=JBossMQReceiverImpl

                          • 10. Re: JBoss 4.0 JMS Cluster Support

                            Hi Kiran,

                            I also want to setup clustered JMS server. Can you please tell me what are the steps I need to do to setup the cluster JMS queue on JBoss.

                            I am using JBoss 4.0.2.

                            I will go through the wiki

                            I added you in my AIM buddy list. my AIM is UmeshCybage.

                            Thanks & Regards,
                            Umesh

                            • 11. Re: JBoss 4.0 JMS Cluster Support

                              Umesh,

                              Setting up a JMS Queue in a cluster (with HA-JMS) is nothing different from the non-clustered setup. Define a Queue in the jbossmq-destinations-service.xml, and that will automatically be visible to the clients all over the cluster through the HA-JNDI.

                              If not, be more specific in your question.

                              Thanks
                              Kiran

                              • 12. Re: JBoss 4.0 JMS Cluster Support

                                Hi Kiran,

                                Thanks for replying. I have few questions regarding using JMS clustering.
                                How to access a Queue ConnectionFactory using HA JNDI?
                                in jndi.properties we specify the ip:port of HA-JNDI, So if we add a node in cluster how we will specify the IP of that if that become the Master node..?

                                Sorry if these are silly questions but I am ont sure how to do that.

                                Thanks,
                                Umesh

                                • 13. Re: JBoss 4.0 JMS Cluster Support

                                  When building an Initial Context, you will need the following 3 properties:

                                  java.naming.factory.initial
                                  java.naming.provider.url
                                  java.naming.factory.url.pkgs

                                  In this case, for java.naming.provider.url value, use a comma separated list of JNDI URLs. For example if the hosts in your cluster are hostname1, hostname2, then

                                  java.naming.provider.url=jnp://<hostname1>:1100,jnp://<hostname2>:1100

                                  Note that you are using the Port=1100, instead of Port=1099. Port 1100 is where the HA JNDI services are available. So, it does not matter where the Queue actually is or where the Master Node is. It does cover you even if one of the nodes were to brought down.

                                  With that setup, the following (typical) code shoud look up the Queue.

                                  InitialContext iniCtx = new InitialContext();
                                  Object tmp = iniCtx.lookup("XAConnectionFactory");
                                  QueueConnectionFactory qcf = (QueueConnectionFactory) tmp;
                                  conn = qcf.createQueueConnection();
                                  que = (Queue) iniCtx.lookup("queue/testQueue");


                                  Kiran

                                  • 14. Re: JBoss 4.0 JMS Cluster Support

                                    Thanks Kiran, I able to setup the cluster JMS for fail over.

                                    Now I have question regarding the load balanacing, which you also had earlier :)

                                    How this load balancing is working..?
                                    What basically the cdot.jboss.JBossMQProvider class does..?

                                    There is a comment "You should use hajndi-jms-ds.xml not the jms provider in this example. TODO: update this example" on wiki http://wiki.jboss.org/wiki/Wiki.jsp?page=LoadBalancedFaultTolerantMDBs

                                    So, what changes we required to use hajndi-jms-ds.xml..?

                                    And the last question, this example was written in April 2004 for JBoss 3.2.4RC2. I am using JBoss version 4.0.2, so is this load balancing is not incorporated in newer version of JBoss (e.g JBoss 4.0.2 or 4.0.3)..?
                                    The JBoss guys might have answer for this whether this is included in new version of JBoss or not.

                                    what if I do not use JBossMQProvider , will all message will be processed by a single MDB..?

                                    Thanks,
                                    Looking forward for yuor response.

                                    -Umesh

                                    1 2 Previous Next