Red Hat Application Server: JOnAS User Guide | ||
---|---|---|
Prev | Chapter 1. Java Open Application Server (JOnAS): a J2EE Platform | Next |
Clustering for an application server generally makes use of three features: Load Balancing (LB), High Availability (HA), and Failover. Such mechanisms can be provided at the Web-container level by dispatching requests to several Servlet/JSP engine instances, at the EJB-container level by dispatching EJB requests to several EJB container instances, and at the database level by using several databases. A replicated JNDI naming is also necessary.
JOnAS provides Load Balancing, High Availability, and Failover at the WEB container level using the Apache Tomcat mod_jk plugin and an HTTP-in-memory session-replication mechanism based on JGroups. The plugin dispatches HTTP requests from the Apache web server to Tomcat instances running as JOnAS web containers. Server fluctuations are automatically taken into account. This plugin supports round-robin and weighted round-robin load-balancing algorithms, with a sticky session option.
Load balancing and HA are provided at the EJB container level in JOnAS. Operations invoked on EJB Home interfaces (EJB creation and retrieval) are dispatched on the nodes of the cluster. The mechanism is based on a clustered-aware replicated JNDI registry using a Clustered remote Method Invocation protocol (CMI). The stubs contain the knowledge of the cluster and implement the load-balancing policy, which may be round-robin and weighted round-robin. In the near future, a load-balancing mechanism based on the nodes load will be available. Failover at the EJB level will be provided by implementing a stateful Session Bean state replication mechanism.
The JOnAS clustering architecture is illustrated in the following figure.
Apache is used as the front-end HTTP server; Tomcat is used as the JOnAS web container. The JOnAS servers share the same database. The mod_jk plug-in provides load balancing/high availability at the Servlet/JSP level. Failover is provided through the in-memory, session-replication mechanism. Load balancing/high availability are provided at the EJB level through the CMI protocol associated with the replicated, clustered-aware JNDI registry. Tomcat may or may not run in the same JVM as the EJB container. JOnAS provides some documentation for configuring such an architecture.
The use of the C-JDBC ObjectWeb project offers load balancing and high availability at the database level (see http://www.objectweb.org/c-jdbc/index.html). The use of C-JDBC is transparent to the application (in our case, to JOnAS), because it is viewed as a standard JDBC driver. However, this "driver" implements the cluster mechanisms (reads are load-balanced and writes are broadcasted). The database is distributed and replicated among several nodes, and C-JDBC load balances the queries between these nodes. An evaluation of C-JDBC using the TPC-W benchmark on a 6-node cluster has shown performance scaling linearly up to six nodes.
In addition to clustering solutions, JOnAS provides many intrinsic mechanisms to ensure high scalable and efficiency:
A pool of stateless Session Bean instances
A pool of Entity Bean instances, configurable for each Entity Bean within its deployment descriptor
Activation/passivation of entity beans (passivation can be controlled through the management console)
Pools of connections, for JDBC, JMS, J2EE CA connectors
A pool of threads for message-driven beans
Session Bean timeout can be specified at deployment
A "shared" flag in the specific deployment descriptor of an Entity Bean that indicates whether the persistent representation of this Entity Bean is shared by several servers/applications, or whether it is dedicated to the JOnAS server where it is loaded. In the latter case, the optimization performed by JOnAS consists of not reloading the corresponding data between transactions.
The usual EJB 1.1 "isModified" (or "Dirty") mechanism is available, for avoiding storage of unmodified data.
Some benchmarks and JOnAS Use cases have already proven that JOnAS is highly scalable. Refer to the Rubis http://www.cs.rice.edu/CS/Systems/DynaServer/perf_scalability_ejb.pdf results or the OpenUSS Use case (http://openuss.sourceforge.net/openuss/). Rubis is a benchmark for e-commerce J2EE applications, which now belongs to the ObjectWeb JMOB (Java Middleware Open Benchmarking) project (http://www.objectweb.org/jmob/index.html). OpenUSS is an operational university portal that has approximately 20,000 users.