9 Replies Latest reply on May 22, 2002 3:31 AM by Olivier Blanc

    Load balancing

    Olivier Blanc Newbie

      Hi there,
      I am definitely now to JBoss and want to understand how I can setup a load balancing policy between Apache/Tomcat and 2 JBoss servers.
      Could you help ?

      Tnx a lot


        • 1. Re: Load balancing
          Sacha Labourey Master


          If you want that apache load-balances calls for a cluster of tomcat/jboss instances, you should take a look at apache documentation then.



          • 2. Re: Load balancing
            Olivier Blanc Newbie

            Let me explain a bit more about my architecture (that was not clear in my previous message).
            I have Apache and Tomcat running on a Web server to take care of HTML static and JSP/Servlet parts of application. Then, I have 2 JBoss servers, clustered, to take care of EJB that describe the functional part of the application.
            I would like that Tomcat realizes some load balancing to choose the less charged JBoss server to send EJB requests.

            So the questions that I wanted to ask are :
            Is the architecture with 2 kinds of servers (Apache/tomcat on one side and Jboss cluster on the other) possible and a good one, or what are the alternatives ?
            How can I make load balancing between Apache/Tomcat and JBoss cluster ?

            Thanks a lot for your help


            • 3. Re: Load balancing
              Sacha Labourey Master

              Hello Olivier,

              It depends where you have the more processing load: apache, servlet or EJB? If you have a lot of servlet-ejb communication, you should probably put the servlet container and JBoss on the same computer, better, in the same VM. In this case, you will use Apache LB features.

              If that is not the case (i.e. you put apache+tomcat on the same host), then you need to use Apache LB to load-balance incoming calls and decide what to do with httpsessions. HttpSession replication has one version available for tomcat. It will be shortly commited in JBoss CVS tree and most probably available in 3.1. Support for Jetty should be there soon (code is already in). In any case, you will need to deal with "sticky-sessions" i.e. your LB has to associate a client with a particular node of the cluster.

              • 4. Re: Load balancing
                Jeff Brown Newbie


                Based on your reply, can I assume/hope if I have JBoss/Tomcat or JBoss/Jetty on the same machine and clustered that it will take care of the persistent sessions because everything is in shared memory on all clustered machines?


                • 5. Re: Load balancing
                  Sacha Labourey Master

                  Yes, exactly. But code for Jetty is not finished being debugged yet. Sorry. But that is the feature, yes.

                  • 6. Re: Load balancing
                    Chad Manning Newbie

                    In a blissful open source world, I'll be using Linux Virtual Server as my load balancer. LVS is a good basic load balancer that handles persistence (stickiness) based on IP. Unfortunately, people behind proxies (AOL) may still experience non-sticky sessions. My understanding was that session information will be shared across the jetty/jboss cluster, eliminating the need for the load balancers to enforce sticky sessions. Your statement below confused me. I was still planning on having LVS do it's best attempt to maintain persistence, assuming that this could only help performance.
                    I adjusted the session clustering parameters to be: 1) storage strategy-clustered store 2) snapshot frequency-request (coupled with lb-sticky session attempt, does this decrease the session chatter between jetty servers?)3) not sure about notification policy- activate?
                    I've been testing, but so far unable to replicate session info.

                    you wrote:
                    > In any case, you will need to deal with "sticky-sessions" i.e. your LB has to associate a client with a particular node of the cluster.

                    • 7. Re: Load balancing
                      Olivier Blanc Newbie

                      Finally, I set up a LVS in front of the JBoss servers.
                      It seams to work, so far, but I need to understand a bit more how the replication is done between JBoss servers and what is the frequency of the replication.
                      Does any one have information on how to set up those parameters and tune the replication ?



                      • 8. Re: Load balancing
                        Chad Manning Newbie

                        I unjarred the jetty-plugin.sar, edited the service file in the META dir, re-jarred it back up (.sar). I did all of this with jboss down and restarted, although it may be able to do the changing hot... C

                        • 9. Re: Load balancing
                          Olivier Blanc Newbie

                          Hi all,
                          I did see the point in the service file. But I do need to replicate beans between the servers.
                          I declare my bean with the <clustered>True</clustered> in the jboss.xml, but it doesn't seem to be replicated on all the clustered servers.
                          How can I check that and set up all what is needed ?

                          Thanks for help