Load Balancing by the Java Dispatcher

The Java dispatcher uses the J2EE Engine Load Balancing System to perform load balancing for various types of client requests. The Load Balancing System is used to distribute requests to resources within the cluster. When a client application requests a resource of a server process, the Load Balancing System chooses the most appropriate server within the cluster to dispatch the request to. This system is implemented in the J2EE Engine by means of the “Round Robin” algorithm.

Features of the Load Balancing System

The Load Balancing System is used by distributed services only (services that run on the dispatcher and server elements of the cluster). The services running on the Java dispatcher use this system to determine which server process will work on the request.

The J2EE Engine Load Balancing System implements the following functions:

·        Load balancing of system (cluster) resources using the “Round Robin” algorithm.

·        Monitoring each server process for a particular service that can process the incoming request.

·        The Load Balancing system includes only the server cluster elements that are not stopped or marked for shutdown:

Ў        When a server element is shut down, it is excluded from the Load Balancing system. When a new element is started, it is included in the system.

Ў        When there is a server process marked for shutdown, it is excluded from the Load Balancing System. The mark for shutdown option is used if you want to stop a particular server process without terminating the work of the clients that are currently connected to it. The J2EE Engine waits for the current requests to be processed and then stops the corresponding element. After the element is stopped the Load Balancing System stops sending requests to it.

Homogeneous Load Balancing for HTTP Requests

When the HTTP Provider Service is not configured for heterogeneous load balancing, it uses the homogeneous load balancing algorithm to determine the appropriate server process to dispatch the request to. When an HTTP request reaches the Java dispatcher and it is not part of a user session, the load balancing chooses a server process randomly from all the server processes within the Java instance that have an HTTP Provider Service running on them.

When using homogeneous load balancing, all your Web applications must be running on each server process in the cluster. By default, the J2EE Engine Deploy Service starts a Web application on each server process once the application is successfully deployed. However, you have the option of stopping the application on a random server process. If you do this, you must consider switching on the heterogeneous load balancing functions of HTTP Provider Service.

For more information, see Load Balancing for J2EE Web Applications and Registering Server Processes for HTTP Load Balancing.

Load Balancing for RMI-P4 and RMI-IIOP Requests

The load balancing mechanism for RMI-P4 and RMI-IIOP requests is based entirely on the functions of the Load Balancing System. Load balancing for this type of requests is performed on the Java dispatcher when remote clients attempt to obtain initial context references to the remote server-side object. After obtaining the initial context, the ID of the server process on which the remote object resides is encoded into the request, so that consequent requests to the same object are dispatched to the same server process.

Using the Message Server, it is possible to enable instance-level load balancing for RMI-P4 requests. For more information, see Load Balancing of Client RMI-P4 Requests in the Development Manual.