42.4. Load Balancing at the EJB Level

This section describes how to configure JOnAS to run the following architecture:

Figure 42-4. Load Balancing

42.4.1. CMI Principles

CMI is a new ORB used by JOnAS to provide clustering for load balancing and high availability. Several instances of JOnAS can be started together in a cluster to share their EJBs. It is possible to start the same EJB on each JOnAS, or to distribute their load. A URL referencing several JOnAS instances can be provided to the clients. At lookup time, a client randomly chooses one of the available servers to request the required bean. Each JOnAS instance has the knowledge (through JavaGroups) of the distribution of the beans in the cluster. An answer to a lookup is a special clustered stub, containing stubs to each instance known in the cluster. Each method call on the home of the bean can be issued by the stub to a new instance, to balance the load on the cluster. The default algorithm used for load distribution is currently a weighted round-robin.

42.4.2. CMI Configuration

In the case of EJB level clustering (CMI), the client may be either a fat Java client (for example, a Swing application), or a Web application (that is, Servlets/JSPs running within JOnAS). In the second case, the JOnAS server running the Web client should be configured in the same way as the other nodes of the cluster.

NoteNotes
 

The multicast address and group name must be the same for all JOnAS servers in the cluster.

If Tomcat Replication associated to cmi is used, the multicast addresses of the two configurations must be different.