Abstract
| Goal |
Configure various subsystems to support the deployment of clustered applications. |
| Objectives |
|
| Sections |
|
| Lab |
|
Identify the benefits of clustering and the JBoss EAP subsystems involved in supporting clustered application deployments.
Describe example topologies of clustered applications.
A cluster is a collection of servers that communicate with each other to provide the following capabilities for the services that run in the cluster:
Improves service availability in the event of server failure.
A service can handle a large number of requests by spreading the workload across multiple servers.
If a service fails, then the client can continue processing its tasks as another cluster member takes over the client's requests.
The most important components to achieve scalability and high availability are the load balancer, and the data replication services:
Load balancer: It can be a hardware load balancer, or a software load balancer such as Apache httpd, or a JBoss EAP instance. The load balancer can manage a big amount of request by sending the client traffic to different instances of the application server.
Data replication services: Services that run in the application servers and copy data between different cluster members. If the application server copies the data that applications need, then any cluster member can manage client requests.
JBoss EAP provides HA mechanisms for the following application server services:
Web applications and their HTTP sessions
Jakarta Messaging services and message-driven beans (MDBs)
Stateful and stateless session Jakarta Enterprise Beans (EJBs)
Singleton services and deployments
JBoss EAP uses two subsystems to provide HA: jgroups and infinispan.
The ha and full-ha profiles have these subsystems enabled and configured by default.
In JBoss EAP, a cluster is a set of identically-configured servers that provide cluster capabilities. Although you can run JBoss EAP in either standalone or managed domain mode, these operating modes only dictate how the servers are managed. You can form JBoss EAP clusters in both operating modes.
In a standalone server a cluster is a collection of running JBoss EAP instances:
In a managed domain, a cluster is actually a collection of servers in a server group, with each server in the server group representing the nodes of the cluster:
The following diagram is an example of a managed domain, which contains clusters.
There are three nodes that host eight combined servers, which are divided into three different groups.
In a managed domain, a cluster is a collection of servers. In addition, a cluster can consist of two or more server groups, with all servers in the clustered server groups being the nodes of the cluster. As the diagram shows, you can have multiple clusters within a domain, and can have servers in a server group that do not form a cluster.
The configuration of the JGroups subsystem is what defines if two JBoss EAP Java instances form a cluster, not the management mode.
Clustering is accomplished by the Infinispan and JGroups subsystems.
In the previous diagram there is a load balancer that distributes the HTTP, or EJB client requests. The Infinispan and the JGroups subsystem forms the infrastructure for internal cluster communications.
A community project used for distributed caching, and replicating objects between caches. The Infinispan subsystem provides caching and state replication support for HTTP sessions, EJB instances, and other JBoss EAP services that need HA.
A framework to create an overlay network over TCP/IP. JBoss EAP uses JGroups to communicate members and replicate objects between cluster members by using either UDP or TCP.
Infinispan and JGroups are two large frameworks that each contain many capabilities and configuration settings. This section requires only the basic concepts of Infinispan and JGroups.
See the references section for more information about Infinispan and JGroups.
Following the Jakarta EE specifications, to mark a web application as clustered, you need to include the <distributable> tag in the web.xml application configuration file:
<?xml version="1.0"?>
<web-app ...>
<distributable/>
...ouput omitted...
</web-app>When the web application is clustered the HTTP session for each web client is replicated between two or more JBoss EAP cluster members.
You can fine tune the replication configuration by overriding the defaults in the application jboss-web.xml file by adding a <replication-config> tag.
The following is an example configuration that defines that the entire session is replicated.
Note that this is the actual default behavior for JBoss EAP:
<jboss-web ...>
<replication-config>
<replication-granularity>SESSION</replication-granularity>
</replication-config>
</jboss-web>There are two possible values for the <replication-granularity> tag:
SESSION
A session level of replication granularity means that the entire session object is replicated whenever any attribute changes. It is the default option.
ATTRIBUTE
Only the changed attributes in a session are replicated.
For more general information about HA in JBoss EAP, see to the Configuring High Availability chapter in the Configuration Guide in the Red Hat JBoss EAP documentation at https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.4/html-single/configuration_guide/index#configuring_high_availability
For deeper information about web applications HA, see the Clustering in Web Applications chapter in the Development Guide in the Red Hat JBoss EAP documentation at https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.4/html-single/development_guide/index#clustering_in_web_applications