5 min read

(For more resources related to this topic, see here.)

Understanding high availability

To understand the term high availability, here is its definition from Wikipedia:

“High availability is a system design approach and associated service implementation that ensures that a prearranged level of operational performance will be met during a contractual measurement period. Users want their systems, for example, hospitals, production computers, and the electrical grid to be ready to serve them at all times. If a user cannot access the system, it is said to be unavailable.”

In the IT field, when we mention the words “high availability”, we usually think of the uptime of the server, and technologies such as clustering and load balancing can be used to achieve this.

Clustering means to use multiple servers to form a group. From their perspective, users see the cluster as a single entity and access it as if it’s just a single point. The following figure shows the structure of a cluster:

To achieve the previously mentioned goal, we usually use a controller of the cluster, called load balancer, to sit in front of the cluster. Its job is to receive and dispatch user requests to a node inside the cluster, and the node will do the real work of processing the user requests. After the node processes the user request, the response will be sent to the load balancer, and the load balancer will send it back to the users. The following figure shows the workflow:

 

 

Besides load balancing user requests, the clustering system can also do failover inside itself.

Failover means when a node has crashed, the load balancer can switch to other running nodes to process user requests.

In a cluster, some nodes may fail during runtime. If this happens, the requests to the failed nodes should be redirected to the healthy nodes. The process is shown in the following figure:

To make failover possible, the node in a cluster should be able to replicate user data from one to another.

In JBoss EAP6, the Infinispan module, which is a data-grid solution provided by the JBoss community, does the web session replication.

If one node fails, the user request could be redirected to another node; however, the session with the user won’t be lost. The following figure illustrates failover:

To achieve the previously mentioned goals, the JBoss community has provided us a powerful set of tools. In the next section we’ll have an overview on it.

JBoss EAP6 high availability

As a Java EE application server, JBoss EAP6 uses modules coming from different open source projects:

  • Web server (JBossWeb)
  • EJB (JBoss EJB3)
  • Web service (JBossWS/RESTEasy)
  • Messaging (HornetQ)
  • JPA and transaction management (Hibernate/Narayana)

As we can see, JBoss EAP6 uses many more open source projects, and each part may have its own consideration to achieve the goal of high availability. Now let’s have a brief on these parts with respect to high availability:

JBoss Web, Apache httpd, mod_jk, and mod_cluster

The clustering for a web server may be the most popular topic and is well understood by the majority. There are a lot of good solutions in the market.

For JBoss EAP6, the solution it adopted is to use Apache httpd as the load balancer. httpd will dispatch the user requests to the EAP server. Red Hat has led two open source projects to work with httpd, which are called mod_jk and mod_cluster. In this article we’ll learn how to use these two projects.

EJB session bean

JBoss EAP6 has provided the @org.jboss.ejb3.annotation.Clustered annotation that we can use on both the @Stateless and @Stateful session beans.

The clustered annotation is JBoss EAP6/WildFly specific implementation.

When using @Clustered with @Stateless, the session bean can be load balanced; and when @Clustered is used with the @Stateful bean, the state of the bean will be replicated in the cluster.

JBossWS and RESTEasy

JBoss EAP6 provides two web service solutions out of the box. One is JBossWS and the other is RESTEasy. JBossWS is a web service framework that implements the JAX-WS specification. RESTEasy is an implementation of the JAX-RS specification to help you to build RESTFul web services.

HornetQ

HornetQ is a high-performance messaging system provided by the JBoss community. The messaging system is designed to be asynchronous and has its own consideration on load balancing and failover.

Hibernate and Narayana

In the database and transaction management field, high availability is a huge topic. For example, each database vendor may have their own solutions on load balancing the database queries. For example, PostgreSQL has some open source solutions, for example, Slony and pgpool, which can let us replicate the database from master to slave and which distributes the user queries to different database nodes in a cluster.

In the ORM layer, Hibernate also has projects such as Hibernate Shards that can deploy a data base in a distributed way.

JGroups and JBoss Remoting

JGroups and JBoss Remoting are the cornerstone of JBoss EAP6 clustering features, which enable it to support high availability. JGroups is a reliable communication system based on IP multicasting.

JGroups is not limited to multicast and can use TCP too.

JBoss Remoting is the underlying communication framework for multiple parts in JBoss EAP6.

Summary

In this article we learned the basic concepts about high availability and also had an overview of the basic functions of JBoss EAP6. This will help you in understanding JBoss EAP6 in a better way.

Resources for Article:


Further resources on this subject:


LEAVE A REPLY

Please enter your comment!
Please enter your name here