3 Replies Latest reply on May 21, 2003 9:30 AM by Robert Costanzo

    Load Balancing on JBoss 3.2.1 with Jetty and JK Module

    Robert Costanzo Newbie

      Has anybody gotten the JK Module (JK1 or JK2) to work properly with Jetty/JBoss in a clustered environment? I have tried both the JK1 and JK2 modules, and I cannot get either of them to load balance sessions properly. When one of my servers goes down, the session is properly failed over to another server. However, new sessions are always created on the first server in my worker list.

      I know there is a Tomcat specific setting needed to get the JK modules to work (with regards to the JVM route). Is there the equivalent for Jetty which I'm missing?

      I am running Apache 1.3.27 on Linux with JBoss 3.2.1. I have included my worker.properties for the JK1 module below:

      worker.list=srv1, srv2, loadbalancer

      # Define the first srv...
      worker.srv1.port=8009
      worker.srv1.host=localhost
      worker.srv1.type=ajp13
      worker.srv1.lbfactor=100
      worker.srv1.local_worker=1
      worker.srv1.cachesize=20

      # ...and the second srv.
      worker.srv2.port=18009
      worker.srv2.host=localhost
      worker.srv2.type=ajp13
      worker.srv2.lbfactor=100
      worker.srv2.local_worker=1
      worker.srv2.cachesize=20

      # Now we define the load-balancing behavior
      worker.loadbalancer.type=lb
      worker.loadbalancer.balanced_workers=srv1,srv2
      worker.loadbalancer.sticky_session=1
      worker.loadbalancer.local_worker_only=0

        • 1. Re: Load Balancing on JBoss 3.2.1 with Jetty and JK Module
          Dennis Cartier Newbie

          Hi,

          You can get JK1 to load balance properly if you set 'local_worker=0' in your config for each server as displayed above. For some reason (which I have never comprehended) when there are servers marked as local, it always selects the first one in the properties file to send all new sessions to.

          I use this idiosyncrasy to direct ALL new sessions to 1 node when I want to take servers out of the pool by marking 1 node as local and restarting Apache.

          Just for the record, this has nothing to do with JBoss or Jetty.

          Dennis

          • 2. Re: Load Balancing on JBoss 3.2.1 with Jetty and JK Module
            Sacha Labourey Master

            Please try by changing this:

            worker.list=srv1, srv2, loadbalancer

            to this:

            worker.list=loadbalancer

            Cheers,


            sacha

            • 3. Re: Load Balancing on JBoss 3.2.1 with Jetty and JK Module
              Robert Costanzo Newbie

              I've made both of the suggested changes and my sessions are now created properly on each server. I agree that the local worker setting is buggy since it only assumes that only a single worker will ever be local.

              However, I'm now having an issue with regards to sticky sessions. A single user's session gets bounced back and forth between my two appservers. The session itself is being properly replicated (using Jetty's JGStore), so my application is functioning. However, not having sticky sessions is bad for performance due to the cache misses. Again, I'm using the JK module with Apache 1.3.27 and Jetty. Has anyone gotten sticky sessions to work with the JK module and Jetty? Are there any additional configurations which I'm missing?

              Thanks.