JBoss.orgCommunity Documentation

Chapter 6. Server-side Configuration

6.1. JBoss AS
6.1.1. Non-clustered mode
6.1.2. Configuration Properties
6.1.3. Connectors
6.1.4. Node Identity
6.2. JBoss Web & Tomcat
6.2.1. Lifecycle Listener
6.2.2. Additional Tomcat dependencies
6.3. Migrating from 1.1.x
6.3.1. mod_cluster-jboss-beans.xml
6.3.2. server.xml
6.4. Migrating from 1.0.x
6.4.1. Dependency with JBoss Web
6.4.2. server.xml
6.4.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.

  2. A reference to the JBoss mbean server.

e.g.

<bean name="ModClusterListener" class="org.jboss.modcluster.container.jbossweb.JBossWebEventHandlerAdapter"> 
  <constructor> 
    <parameter class="org.jboss.modcluster.container.ContainerEventHandler"> 
      <inject bean="ModClusterService"/>
    </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>

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.container.catalina.standalone.ModClusterListener" advertise="true"/>

In mod_cluster 1.2.x the web containers now are separed cleanly, that requires you to change standalone and mbean configuration a little.

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.