Load Balancing for J2EE Web Applications

The J2EE Engine HTTP Provider Service running on the dispatcher performs heterogeneous load balancing for Web applications. It is an important function when you run distributed applications in a cluster environment. It gives you the opportunity to run an application on a few cluster nodes, and you can always be sure that the client request to that application is dispatched to the correct server where the application is available.

The heterogeneous load balancing is a configurable function of the HTTP Provider Service. For more information, see Configuring Heterogeneous Load Balancing in the Administration Manual. If you have switched off heterogeneous load balancing, the HTTP Provider Service performs homogeneous load balancing as described in the Homogeneous Load Balancing for HTTP Requests section of Load Balancing by the Java Dispatcher.

The Heterogeneous Load Balancing Mechanism

Web applications are identified and invoked using their unique application aliases. The HTTP Provider Service running on the dispatcher keeps a table of records about the Web application alias, and the server IDs of the servers in the cluster where the corresponding application is started. In this way, the Java dispatcher can direct a client request to the appropriate server process where the requested Web application is running.

The heterogeneous load balancing mechanism also uses cookies or URL rewriting as an underlying mechanism to transmit session-related information. The J2EE Engine has defined a load balancing cookie type that defines the format of the information that the HTTP Provider Service needs in order to perform such load balancing.

For more information about the load balancing cookie format, see J2EE Engine Cookies in the Development Manual.

Heterogeneous Load Balancing and HTTP Requests Parsing

The HTTP Provider Service running on the dispatcher parses client requests. Based on its records (as described above), it directs the request to the appropriate cluster element to be processed. The following scenarios are possible:

·        The incoming request is part of a series of requests associated with a user session to a particular Web application. That is, that request has a load balancing cookie attached to it. The HTTP Provider Service gets the value of the cookie and directs the request to the server with the corresponding ID.

·        The incoming request is the first request from the client to that particular Web application. That is, it has no load balancing cookie attached. In this case, if the application is running on more than one server process in the cluster, the request is directed to a random server among all those that have the application started on them. With the response, the server will send a load balancing cookie to the client and all subsequent requests to the same application will be handled as described in the above case.


See also:

Application Alias in the Administration Manual