Java Reference
In-Depth Information
Web application clustering
Web application clustering involves two aspects: setting up an HTTP load balancer,
and telling JBoss to make the application's user sessions HA. How to do the former
depends on what load balancer you choose (
mod_cluster
is our suggested choice);
the latter could not be simpler—just add the
<distributable/>
tag to your applic-
ation's
web.xml
file.
Let's see in concrete how to pursue both steps.
Load balancing your web applications
You have several choices available in order to achieve load balancing of your HTTP
requests; you can opt for a hardware load balancer that sits in front of your cluster of
servers, or you can choose from the many available software solutions for JBoss AS,
which include the following:
• Use ApacheTomcat's
mod_jk
to route your requests to your nodes
• Use Apache
mod_proxy
that configures Apache to act as a proxy server
and forwards requests to JBoss AS nodes
• Use JBoss' built-in solution
mod_cluster
to achieve dynamic load balan-
cing of your requests.
Here we will illustrate how to get started with
mod_cluster
. The advantage of using
mod_cluster
against other options can be summarized in the following key points:
• Dynamic clustering configuration
• Server-side pluggable load metrics
• Lifecycle notifications of the application status
As a matter of fact, when using a standard load balancer such as
mod_jk
, you have
to provide a static list of nodes that are used to spread the load. This is a very limiting
factor, especially if you have to deliver upgrades to your configuration by adding or re-
moving nodes or you simply need to upgrade releases used by single nodes. Besides
this, using a flat cluster configuration can be tedious and prone to errors, especially if
the number of cluster nodes is high.