JBoss.orgCommunity Documentation

Chapter 6. Server-side Configuration

6.1. JBoss AS
6.1.1. Non-clustered mode
6.1.2. Clustered mode
6.1.3. Configuration Properties
6.1.4. Connectors
6.1.5. Node Identity
6.2. JBoss Web & Tomcat
6.2.1. Lifecycle Listener
6.2.2. Additional Tomcat dependencies
6.3. Migrating from 1.0.x
6.3.1. Dependency with JBoss Web
6.3.2. server.xml
6.3.3. mod_cluster-jboss-beans.xml

mod_cluster is supported in AS7 via the modcluster subsystem See AS7.

In other AS version mod_cluster's configuration resides within the following file:

$JBOSS_HOME/server/$PROFILE/deploy/mod_cluster.sar/META-INF/mod_cluster-jboss-beans.xml file.

The entry point for mod_cluster's server-side configuration is the ModClusterListener bean, which delegates web container (i.e. JBoss Web) specific events to a container agnostic event handler.

In general, the ModClusterListener bean defines:

  1. A ContainerEventHandler in which to handle events from the web container. There are two available implementations, the choice of which dictates the mode in which mod_cluster will operate: clustered or non-clustered.

  2. A reference to the JBoss mbean server.

e.g.

<bean name="ModClusterListener" class="org.jboss.modcluster.catalina.CatalinaEventHandlerAdapter"> 
  <constructor> 
    <parameter class="org.jboss.modcluster.ContainerEventHandler"> 
      <inject bean="ModClusterService"/><!-- Non-clustered mode --> 
      <!--inject bean="HAModClusterService"/--><!-- Clustered mode --> 
    </parameter> 
    <parameter class="javax.management.MBeanServer"> 
      <inject bean="JMXKernel" property="mbeanServer"/> 
    </parameter> 
  </constructor> 
</bean>

In non-clustered mode, each JBoss AS node communicates with the load balancer directly, and do not communicate with each other. Non-clustered mode is configured via the ModClusterService bean.

In general, the ModClusterService bean defines:

  1. An object containing mod_cluster's configuration properties.

  2. An object responsible for calculating the load balance factor for this node. This is described in detail in the chapter entitled Server-Side Load Metrics.

e.g.

<bean name="ModClusterService" class="org.jboss.modcluster.ModClusterService" mode="On Demand"> 
  <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster",exposedInterface=org.jboss.modcluster.ModClusterServiceMBean.class)</annotation> 
  <constructor> 
    <parameter class="org.jboss.modcluster.config.ModClusterConfig"> 
      <inject bean="ModClusterConfig"/> 
    </parameter> 
    <parameter class="org.jboss.modcluster.load.LoadBalanceFactorProvider"> 
      <inject bean="DynamicLoadBalanceFactorProvider"/> 
    </parameter> 
  </constructor> 
</bean>

In clustered mode, a single JBoss node (the HA singleton master) communicates with the load balancer on behalf of the other nodes in the cluster. Clustered mode is configured via the HAModClusterService bean. This mode offers the following advantages over non-clustered mode:

In general, HAModClusterService defines:

  1. An object containing mod_cluster's configuration properties.

  2. An object responsible for calculating the load balance factor for this node. This is described in detail in the chapter entitled Server-Side Load Metrics.

  3. An HAPartition, the JBoss clustering group communication building block. The default HAPartition is defined in: $JBOSS_HOME/server/$PROFILE/deploy/cluster/hapartition-jboss-beans.xml

  4. A policy for determining which group member should be designated as the singleton master.

e.g.

<bean name="HAModClusterService" class="org.jboss.modcluster.ha.HAModClusterService" mode="On Demand">
  <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=ModCluster",exposedInterface=org.jboss.modcluster.ha.HAModClusterServiceMBean.class)</annotation>
  <constructor>
    <parameter class="org.jboss.modcluster.config.ha.HAModClusterConfig">
      <inject bean="ModClusterConfig"/>
    </parameter>
    <parameter class="org.jboss.modcluster.load.LoadBalanceFactorProvider">
      <inject bean="DynamicLoadBalanceFactorProvider"/>
    </parameter>
    <parameter class="org.jboss.ha.framework.interfaces.HAPartition">
      <inject bean="HAPartition"/>
    </parameter>
    <parameter class="org.jboss.ha.framework.interfaces.HASingletonElectionPolicy">
      <bean class="org.jboss.ha.singleton.HASingletonElectionPolicySimple"/>
    </parameter>
  </constructor>
</bean>

Like mod_jk and mod_proxy_balancer, mod_cluster identifies each node via a unique jvm route. By default, mod_cluster uses the following algorithm to assign the jvm route for a given node:

  1. Use the value from server.xml, <Engine jvmRoute="..."/>, if defined.

  2. Generate a jvm route using the configured ???. The default implementation does the following:

    1. Use the value of the jboss.mod_cluster.jvmRoute system property, if defined.

    2. Generate a UUID.

While UUIDs are ideal for production systems, in a development or testing environment, it is useful to know which node served a given request just by looking at the jvm route. In this case, you can utilize the org.jboss.modcluster.SimpleJvmRouteFactory. The factory generates jvm routes of the form:

bind-address:port:engine-name

mod_cluster's entire configuration for JBoss Web or Tomcat resides entirely within $CATALINA_HOME/conf/server.xml.

This limits the adds the following constraints to mod_cluster's feature set:

The entry point for JBoss Web and Tomcat configuration is the ModClusterListener. All mod_cluster configuration properties are defined as attributes of the <Listener/> element. For the complete list of configuration properties and their default values, see the chapter entitled Server-side Configuration Properties.

e.g.

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

In mod_cluster 1.0.x, you were required to make several manual configuration changes to the jbossweb service before mod_cluster would be usable. mod_cluster 1.1.x eliminates much of this hassle - and is designed to be fully functional out of the box.