Sun Java System Application Server 9.1 High Availability Administration Guide

ProcedureTo Configure User-defined Load Balancing

  1. Copy roundrobin.c from appserver_install_dir/lib/install/templates to a work directory (for example:/home/user/workspacelb).

  2. Compile roundrobin.c with an ANSI C/C++ compiler (for example Sun Studio compiler or GCC). Be sure to build a dynamic shared library and not a static executable.

    1. If you are using Sun Studio CC Compiler, use the following command to compile:

      cc -G -I<appserver install dir>/lib/install/templates roundrobin.c -o roundrobin.so
    2. If you are using GCC, compile the shared library with this command:

      gcc -shared -I<appserver install dir>/lib/install/templates 
      roundrobin.c -o roundrobin.so

      Note –

      If you encounter a relocation error, compile again using the option "-fPIC." The command will look like this:

      gcc -shared -fPIC -I <appserver install dir>/lib/install/templates 
      roundrobin.c -o roundrobin.so

      On Microsoft Windows, download the Cygwin utility from http://www.redhat.com/services/custom/cygwin. This utility has GCC bundled with it. Use the following GCC command to create a dynamic link library (dll):

      gcc -shared -I<appserver_install_dir>/lib/install/templates 
      roundrobin.c -o roundrobin.dll
  3. Change loadbalancer.xmlto point to the newly built module. This is how loadbalancer.xml will look after the edit.

    <cluster name="cluster1" policy="user-defined" 
    policy-module="home/user/workspacelb/roundrobin.so">
  4. Copy roundrobin.so to the web server instance directory.

  5. Start the web server if it is not running or wait till the load balancer is re-configured.