1 2 Previous Next 16 Replies Latest reply on Jan 18, 2013 11:37 AM by Wolf-Dieter Fink

    Does AS7 still support round robin load balancing?

    Joseph Fouts Novice

      Currently running AS7.0.2.Final

       

      I have an app that has a SLSB that calls another SLSB that I would like to load balance (round robin) with all available servers in a cluster.

      I was able to get this to work in JBoss 5.1.  I would like to migrate this app to AS7.  Will this still work or will I have trouble when I try and migrate to AS7?

       

      I also noticed that AS7 supports EJB 3.1.  Does this mean that I can now use the @Asyncronous annotation in a session bean to get asyncronous calls from a SLSB without the client bean having to wait?

       

      Any help is greatly appreciated.

       

      Thanks.

        • 1. Re: Does AS7 still support round robin load balancing?
          Wolf-Dieter Fink Master

          In AS7.0 you will not have remote access to EJBs.

          With AS7.1 the EJB remote access is implemented (use 7.1 CR...).

          I'm not sure whether the loadbalancing is implemented yet but I suppose you will have it in the FINAL release.

           

          BTW you should think about the design because often there is no difference whether you call remote EJB from one AS instance to another. I see often bigger drawbacks (serialization and remote/network latency) than benefit of LB.

           

          AS7.0 only support web-profile and a part of JEE6 as full-profile.

          AS7.1 will have full EJB3.1 spec support and yes the  @Asynchronous annotation will work

          • 2. Re: Does AS7 still support round robin load balancing?
            Radoslav Husar Master

            With AS7.1 the EJB remote access is implemented (use 7.1 CR...).

            Correct, it is, just use the snapshot where its implemented since last week with fixes.

            I was able to get this to work in JBoss 5.1.  I would like to migrate this app to AS7.  Will this still work or will I have trouble when I try and migrate to AS7?

             

            Yes, unfortunately you will have problems. The problem is that in AS 5.1 you use remote JNDI to lookup and be done. In AS 7.1 for security reasons you wont get remote JNDI, thus you have to use proprietary JBoss EJB3 API to access the beans remotely.

            BTW you should think about the design because often there is no difference whether you call remote EJB from one AS instance to another. I see often bigger drawbacks (serialization and remote/network latency) than benefit of LB.

            +1 just leave everything to the client logic and start tweaking once you run to problems.

             

            Rado

            • 4. Re: Does AS7 still support round robin load balancing?
              Joseph Fouts Novice

              Hi Rado and Wolf.

               

              Thanks so much for your info.  Rado being that most of this is all very new to me  how would I go about getting the JBoss EJB3 API setup so that my beans can be accessed remotely? 

              Is this an EE 6 restriction?

               

              As for the design I would like to give you a better overview of what I am trying to accomplish.

               

              I'm trying to attempt to rewrite a legacy COBOL system using java using JEE.  Thats right COBOL:)

               

              Its a large system that can process millions of policies.

               

              In the example I used regarding the post from this thread I have a client (thick java client) start or initiate an open on the system.

              This process kicks off background transactions to process work(lots of records).  The volume on many of them can be very large.  Because of this volume and in some cases the small window to process those records I'm concerned about java not being able to process all of the records in an excepeble

              time. This is where my idea for clustering servers came from.

               

              So I have a SLSB listener running on just one server that excepts calls from the client.

              Client opens the system.

              SLSB gets call from client and then calls a master background SLSB.  I need this this call to be Asynchronous so that all master backgrounds can start and not make the client wait for return.

              The master background SLSB is the one who processes all of the records.  For each record needing work another SLSB is called to complete the work on that record.  This SLSB is the bean

              that I need to be clustered.  My thought was that if I could get these SLSB's to process in a cluster and Asynchronously then my concern about java and its performance would not be as big of a concern.

              Based on the load I would just add additional clustered servers to the cluster to handle any additional load needed by the background processes.

               

              When testing this in JBoss 5.1  I was able to get clustering to work where I had a background process cyle through 3 records to work on and pass them to each of the 3 systems I had in the cluster.  Load balancing was set to round robin.  (Thanks again Wolf).

              Though this worked I did not want both the Master SLSB or the client to wait for return from each of the SLSB calls.  This was when I realized I needed Asynchronous support.  With some help from Wolf I found out that this was not supported in Jboss 5.1 and I would have to migrate to AS7.

               

              So this is where I am.  You guys have been a big help and any other information that you could give me would be greatly appreciated.

               

              Thanks.

              • 5. Re: Does AS7 still support round robin load balancing?
                Wolf-Dieter Fink Master

                A documentation how to access remote EJB is here https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+client+using+JNDI

                 

                Your explanation sounds to me like a 'fire and forget' scenario.

                If I understand right you have one client that start a big action without intrest on the result.

                -->? Is it only one batch operation or do you have multiple request like this at the same time?

                 

                To scale such senario I would recommend a message based approach.

                -> one client (or even a SLSB called by client) produce a bunch of messages

                -> the messages are processed by the JMS system

                 

                The message consumer can be configured whether it is clustered or not, you do not care about LB and failover.

                • 6. Re: Does AS7 still support round robin load balancing?
                  Joseph Fouts Novice

                  Your explanation sounds to me like a 'fire and forget' scenario.

                  If I understand right you have one client that start a big action without interest on the result.

                  -->? Is it only one batch operation or do you have multiple request like this at the same time?

                   

                  You are correct about the one big action.

                  That actions is to start 6 master background beans.

                        Each master beans job is to find a records to work on and then ship them off to another bean to actually do the work on the record.

                        There is only one master bean for each of the 6 master background types(processes different records).

                   

                        Because of the load(number of records) I wanted to cluster to handle the load.

                                

                  As for the request.  There is only one request permitted to start or initiate the system and the background process.

                   

                   

                   

                  To scale such scenario I would recommend a message based approach.

                  -> one client (or even a SLSB called by client) produce a bunch of messages

                  -> the messages are processed by the JMS system

                   

                  The message consumer can be configured whether it is clustered or not, you do not care about LB and failover.

                   

                   

                  I am not familar with message beans so I am not that clear on how they would work.

                   

                  How would message beans solve my potential load problem?

                  So the master creates 100,000 messages. One for each record to process.

                   

                  So do I have multiple servers running the receiver message bean?

                  Then do they just all fight for the messages until they are all complete?

                   

                  Just guessing on how it might work.

                   

                  Thanks again for all of your input.

                  • 7. Re: Does AS7 still support round robin load balancing?
                    Wolf-Dieter Fink Master

                    JMS system is very easy to understand.

                    You create a Message and send it to a queue.

                    A MDB implements one onMessage() method and the container call this method and give the Message as parameter as long as there is an entry in the queue.

                     

                     

                    In your case it sounds like an architecture issue.

                    I suppose that producing 100,000 messages or SLSB calls is a very big overhead and does not bring the performance you expect. I think one record might be proceeded in mills.

                    You should think about it and split it i.e. in bunches of 100 or 1,000.

                    Otherwise I suppose that you have problems with (network) latency DB bottleneck or system resource problems with such many threads.

                    • 8. Re: Does AS7 still support round robin load balancing?
                      Joseph Fouts Novice

                      So is the message bean deployed on many nodes to handle the load?

                       

                      My goal is to just be able to process the many records on multiple application servers.

                      If this can happen then I would be willing to give the message bean a try.

                       

                      Thanks.

                      • 9. Re: Does AS7 still support round robin load balancing?
                        Wolf-Dieter Fink Master

                        You have to deploy the application with the MDB on each cluster-node, similaras with the SLSB.

                        The Queue definition must be deployed as 'clustered' and then JBoss do the distribution.

                         

                        You might use AS5.1 or AS7.1, the difference is the JMS provider, 5.1 use JBossMessaging and 7.1 HornetQ. The configuration and behaviour might be different but the result should be the same.

                        • 12. Re: Does AS7 still support round robin load balancing?
                          Joseph Fouts Novice

                          I would like to take the remote ejb sample for AS 7.1 to the next step and try and get it to work the same way I had sample clusterinng environment working in JBoss 5.1

                           

                          Using the JBoss 7 remote ejb sample I am able to get a simple java client program to lookup and call a method from a SLSB successfully.

                           

                           

                          1.  I want this same test to work in a standalone cluster.

                           

                                                     Client

                                   

                                    machine#1          machine#2      

                             

                               a.  Copy jboss folder to machine #2

                               b.  Modify each machine's standalone-ha.xml to reflect it's IP address.

                               c.  Modify the java client's jboss-ejb-client.properties to include both machines as resouces.

                               d.  Start server on each machine using the standalone-ha.xml.

                               e.  Execute client.

                           

                               Is there anything more that I need to setup or consider to get clustering to work for this test?

                              

                              If the client is running on machine #1 can I expect the calls to be accomplished in a round robin fashion?  machine#1...machine#2...machine#1...

                           

                           

                          And now the real challenge.....

                           

                          2.  I want to add one more SLSB tier in the middle.  This will be machine#3.

                           

                                                     Client

                                   

                                                   machine#3

                           

                                    machine#1          machine#2     

                           

                          The SLSB on machine#3 will get requests from the client. 

                          machine#3 will then load balance the client requests to machine#1 and machine#2 in a round robin fashion.

                           

                           

                          Rado, Wolf and other resident JBoss 7 experts can this type of example work with JBoss 7.1.0.Final?

                              

                           

                          Any and all help is greatly appreciated.

                           

                          Thanks.

                          • 13. Re: Does AS7 still support round robin load balancing?
                            Radoslav Husar Master

                            Hi again Joseph,

                             

                            Looking at 1/

                             

                                 b.  Modify each machine's standalone-ha.xml to reflect it's IP address.

                            Yes, or use the command line switch (if you want to reuse the exactly same profile -- xml).

                                 c.  Modify the java client's jboss-ejb-client.properties to include both machines as resouces.

                            Also can set this up programatically, if that would help in any way.

                                 Is there anything more that I need to setup or consider to get clustering to work for this test?

                            Nothing else I can think of, looks good.

                                If the client is running on machine #1 can I expect the calls to be accomplished in a round robin fashion?  machine#1...machine#2...machine#1...

                            I think you can safely leave this to the client. It knows well what to do, either way something very similar to round robin must happen.

                             

                            And now the real challenge.....

                            So looking at 2/ what kind of challenge it is :-)

                            2.  I want to add one more SLSB tier in the middle.  This will be machine#3.

                            So you want something in the middle. The question I have is why you want to do it like this?

                             

                            This should work: The machine #3 will be running some EJBs that the client talks to. Those EJBs will call some other EJBs. They are not going to be the same ones -> and the behaviour you describe is what would happen. There will be another client running inside of #3 talking to #1 and #2.

                             

                            Regarding calling EJBs from the container, take a look at  https://issues.jboss.org/browse/AS7-3492 (calls are always local).

                             

                            Rado

                            • 14. Re: Does AS7 still support round robin load balancing?
                              Joseph Fouts Novice

                              Thanks for your help.

                               

                              --> I think you can safely leave this to the client. It knows well what to do, either way something very similar to round robin must happen.

                               

                                   Our client is a thick java client and not a web app.  I hope this does not make a difference. 

                                   I guess I do have some concerns about round robin actually working from the client just because I can't even get the sample

                                   "EJB invocations from a remote client using JNDI" to actually do the round robin load balancing.  And for this sample clustering was not

                                   involved.

                               

                                   You can view the thread I started on this issue that I am having here:  https://community.jboss.org/message/717679#717679

                                    Can you see anything that I might be doing wrong here?

                               

                               

                              --> So you want something in the middle. The question I have is why you want to do it like this?

                               

                                   Well In JBoss 5.1 when I tried to get the same test case to work I had to add this layer in order to get clustering from within the container to work.

                                   I think you might even have helped me with this issue.  The only way to get round robin to actually work in JBoss 5.1 was to put a SLSB on a

                                   server all by its self.  That SLSB would do the lookup of the context one time and then call a clustered SLSB on each of the clustered servers

                                   defined in the PROPS.  This was the ONLY way that I was able to get clustering with round robin load balancing to work coming from the client.

                               

                                   Once I got this to work I ran into a problem needing ASYNCHRONOUS session beans.  Found out that this was supported in EJB 3.1 and that

                                   EJB 3.1(at least the full version)  was only going to be support in AS 7.  So here I am trying to get the same test I was able to get working

                                   in JBoss 5.1 to work JBoss 7.

                               

                               

                              -->  Regarding calling EJBs from the container, take a look at  https://issues.jboss.org/browse/AS7-3492 (calls are always local).

                               

                                    Calling clustered EJB's from the container is my primary goal.  When I read the link that you gave me it say this this was for SFSB's. 

                                    Is it implied that this bug is also for SLSB's?

                               

                                    Being fairly new to the community how long do you think that it will take to get this kind of issue resolved.  I would have that that it would

                                    have been part of 7.1.0.Final.

                               

                               

                               

                              Again thanks for your help and any additional help that you may be able to give me.

                              1 2 Previous Next