Red Hat Training

A Red Hat training course is available for Red Hat JBoss Operations Network

32.5. Managing mod_cluster Deployments for JBoss EAP 5 (Tech Preview)

The mod_cluster module provides intelligent, dynamic load balancing for web applications. There are two halves to mod_cluster: one in the JBoss application server (which manages the web application contexts) and one in the HTTP server (which manages sessions and routing). JBoss ON monitors and manages the mod_cluster module within the JBoss server.

32.5.1. About mod_cluster

mod_cluster is an HTTP load balancer that provides a level of intelligence and control over web applications that is not available with other HTTP load balancers. mod_cluster has lots of features that improve performance and management, but two are crucial:
  • By using multicast (advertising), mod_cluster signals workers what proxy servers are available, so workers can register themselves dynamically with the cluster domain.
  • Using a special communication layer between the JBoss server and the HTTP server, mod_cluster can not only register when a web context is enabled but also when it is disabled and removed from load balancing. This allows mod_cluster to handle full web application life cycles.
More detail about the features of mod_cluster is in the product documentation at http://www.jboss.org/mod_cluster.
mod_cluster has two modules: one for the HTTP server which handles routing and load balancing and one for the JBoss server to manage the web application contexts. Both modules must be installed and configured for the cluster to function.
The mod_cluster Topology

Figure 32.3. The mod_cluster Topology

In JBoss ON, the entire mod_cluster domain is imported as a child resource for the JBoss server. The web application contexts are listed as children resources for the cluster, with contexts as children within the mod_cluster module.
The mod_cluster Resource Hierarchy

Figure 32.4. The mod_cluster Resource Hierarchy

Important

The mod_cluster module in the HTTP server is configured externally from JBoss ON and is not managed by JBoss ON.
The mod_cluster module in the JBoss server can be managed by JBoss ON, and it is critical that the cluster is properly configured in order for JBoss ON to manage its resources. JBoss ON detects mod_cluster like any other JMX resource (such as Hibernate).
There are a number of resources available for installing and configuring mod_cluster:

32.5.2. Managing mod_cluster

The mod_cluster properties provide direct management over how the mod_cluster domain operates. Almost any part of the mod_cluster configuration can be managed through JBoss ON, but two elements are critical for domain behavior:
  • How the mod_cluster domain handles sticky sessions. Sticky sessions are enabled in mod_cluster by default, but this can be disabled or its behavior can be changed through the configuration properties.
  • Enabling advertising (multicast). mod_cluster can send the JBoss information to any VirtualHost configured in the HTTP server. This allows workers to find the cluster and register themselves with the JBoss server dynamically.
Setting Server-Level Properties

Figure 32.5. Setting Server-Level Properties

The server-level operations apply to all web application contexts configured within the mod_cluster domain. The obvious ones that impact the web application contexts are enabling and disabling all contexts. The other options are used to reset the mod_cluster domain after an error (reset the node) or reload the cluster configuration after making changes to the cluster properties.
Running Server-Level Operations

Figure 32.6. Running Server-Level Operations

32.5.3. Managing Web Applications Contexts

JBoss ON manages the full lifecycle of web application contexts within the mod_cluster load-balancing cluster.
Web application contexts can be stopped or disabled. Stopping or disabling a webapp context removes it from load-balancing balancing so that the Apache server cannot forward requests to the webapp, but it leaves the application running and available directly from the JBoss server address. (Stop allows the webapp context to drain before removing it from the load-balancing, so this essentially shuts down the webapp gracefully. It can take several minutes or even hours for the webapp context to stop. Disabling a webapp context immediately removes it from load balancing.)
JBoss ON has operations that allow JBoss administrators to manage the state of their web contexts within the mod_cluster domain.
Running Web Application Context Operations

Figure 32.7. Running Web Application Context Operations

Web context resource operations only apply to the specific selected context.