7 Replies Latest reply on Aug 25, 2010 5:13 PM by pferraro

    mod_cluster load balancing

    rmdavidson

      Hi all,

       

      We have a SOA Platform v4.3.0 setup in production that we are adding mod_cluster support to.  The mod_cluster setup is working fine, but I can't figure out how to set up the load balancing feature of mod_cluster to use the AverageSystemLoadMetric (or any other for that matter).

       

      We don't use mod-cluster.sar, I'm using mod-cluster.jar deployed into the jboss-web.deployer directory.

       

      Is it possible to use the AverageSystemLoadMetric module to send requests to servers with the least load in this configuration?  If so, what do I need to do to get this working?

       

      I've tried numerous things, but I can't seem to get it right.  I don't know how to load the AverageSystemLoadMetic module, and I'm not 100% sure how to tell mod_cluster to use it once I have loaded it.

       

      Any help is *very* appreciated.

       

      Thanks,

      Robert Davidson.

        • 1. Re: mod_cluster load balancing
          jfclere

          Which listener are you using?

          • 2. Re: mod_cluster load balancing
            rmdavidson

            Hi Jean.

             

            <Listener className="org.jboss.modcluster.ModClusterListener" .../>

             

            Thanks,

            Rob.

            • 3. Re: mod_cluster load balancing
              pferraro

              Try this:

              <Listener className="org.jboss.modcluster.ModClusterListener"

                        loadMetricClass="org.jboss.load.metric.impl.AverageSystemLoadMetric"

                        ... />

               

              The load properties are documented here:

              http://www.jboss.org/mod_cluster/java/properties.html#load

               

              This will

              N.B. AverageSystemLoadMetric uses OperatingSystemMXBean.getSystemLoadAverage() which requires at least Java 1.6.

              • 4. Re: mod_cluster load balancing
                mrojas435024

                Hi Paul,

                 

                I am using:  <Listener className="org.jboss.modcluster.catalina.ModClusterListener"  advertise="true"/>

                how I could use another load metric?

                • 5. Re: mod_cluster load balancing
                  pferraro

                  e.g.

                  <Listener className="org.jboss.modcluster.catalina.ModClusterListener"

                      loadMetricClass="org.jboss.modcluster.load.metric.impl.AverageSystemLoadMetric"

                      advertise="true"/>

                   

                  You can also override the default settings for history, weight and capacity.

                  The list of properties governing load factor behavior and their default values are described here:

                  http://docs.jboss.org/mod_cluster/1.1.0/html/java.properties.html#load

                  The complete set of available load metrics are listed here:

                  http://docs.jboss.org/mod_cluster/1.1.0/html/java.load.html

                  • 6. Re: mod_cluster load balancing
                    mrojas435024

                    Thanks Paul for your answer,

                     

                    but I tried this:

                        <Listener className="org.jboss.modcluster.catalina.ModClusterListener"

                        loadMetricClass="org.jboss.modcluster.load.metric.impl.AverageSystemLoadMetric"

                        advertise="true"/>

                     

                    and  it throws me the next error :

                     

                    java.lang.NullPointerException
                      at org.jboss.modcluster.catalina.ModClusterListener.createLoadBalanceFactorProvider(ModClusterListener.java:118)
                      at org.jboss.modcluster.ModClusterService.init(ModClusterService.java:164)
                      at org.jboss.modcluster.catalina.CatalinaEventHandlerAdapter.init(CatalinaEventHandlerAdapter.java:326)
                    at org.jboss.modcluster.catalina.CatalinaEventHandlerAdapter.lifecycleEvent(CatalinaEventHandlerAdapter.java:246)
                      at org.jboss.modcluster.catalina.ModClusterListener.lifecycleEvent(ModClusterListener.java:145)
                      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
                      at org.apache.catalina.core.StandardServer.initialize(StandardServer.java:770)
                      at org.apache.catalina.startup.Catalina.load(Catalina.java:524)
                      at org.apache.catalina.startup.Catalina.load(Catalina.java:548)
                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                      at java.lang.reflect.Method.invoke(Method.java:597)
                      at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:261)
                    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

                     

                    what am I doing wrong?

                    • 7. Re: mod_cluster load balancing
                      pferraro

                      Actually, this is a bug.  Looks like this has been around for a while.  Thanks for bringing it to my attention.

                      https://jira.jboss.org/browse/MODCLUSTER-183

                       

                      I've committed a fix to trunk.  Unfortunately, we've already tagged 1.1.0.Final for release.

                      Until 1.1.1 is released, you can build the server-side module from source.  Instructions here:

                      http://docs.jboss.org/mod_cluster/1.1.0/html/java.building.html