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 book 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.

Tip

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 database 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.

Tip

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

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