Sun GlassFish Enterprise Server v2.1.1 High Availability Administration Guide

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.