Sun GlassFish Enterprise Server v2.1.1 High Availability Administration Guide

Features of the HTTP Load Balancer Plug-in

The load balancer provides increased flexibility and ease-of-use through the following features.

Auto Apply

Enterprise Server allows changes to the load balancer configuration made from the Admin Console to be automatically sent over the wire to the Web Server configuration directory. With previous versions of Enterprise Server, the load balancer configuration had to be exported and then copied over to the web server configuration directory.

Weighted Round Robin

The load balancer enables improved distribution of HTTP requests. The administrator can use an attribute called 'weight' to specify how requests will be proportionately routed to an instance. For example, suppose a cluster has two instances, and the administrator has assigned a weight of 100 to instance x and a weight of 400 to instance y. Now, for every 100 requests, 20 will go to instance x and 80 will go to instance y.

User–defined Load Balancing

Enterprise Server enables the administrator to define a custom policy for distributing HTTP requests. A custom policy defines the load balancing algorithm that the load balancer plug-in must use. In other words, the Administrator can define which instance will handle an HTTP request. To use this feature, the administrator needs to develop a shared library, which must implement an interface called loadbalancer.h. The shared library can, for example, be used to evaluate the headers of incoming requests provided to it and in accordance to some criteria, select the instance that can serve the request. This shared library would be loaded by the load balancer.

The interface loadbalancer.h is available under webserver_install_dir/plugins/lib/install. Enterprise Server also bundles a shared library called roundrobin.c, that the administrator can use as a template to build the shared library.