Sun Java System Web Server 6.1 SP9 Performance Tuning, Sizing, and Scaling Guide

Testing

To test the load balancer, you can create an NSAPI plugin that prints an HTML page and then calls sleep() for a period to simulate execution time. This way you can build up a simulated load on the server and ensure that the load balancer commands are working properly.

ProcedureTo configure the sample program

  1. Add a new mime.type so this isn't run for every request by modifying config/mime.types and adding:

    type=magnus-internal/sleep exts=sleep

  2. Create a file in your document root directory with the extension of .sleep.

    It does not matter if anything is in this file; it is used only as a placeholder.

  3. Load the module into the server by editing magnus.conf.

    Init fn="load-modules" funcs="dosleep" shlib="/opt/SUNWwbsvr/plugins/nsapi/examples/dosleep.so" pool="sleep"

    In the example above, you are changing shlib to the location of the library, and setting pool to the name of the thread pool you defined earlier.

  4. Add this Service line where the others are found (note that order is not important):

    Service method="(GET|HEAD)" fn="dosleep" duration="10" type="magnus-internal/sleep"

    The argument duration tells the server how long to sleep for each request in seconds.

  5. Restart your server.

    You should now be ready to test the load balancer plugin. The NSAPI plugin will keep the threads busy long enough to simulate your desired load. The load balancing plugin is tested by retrieving the .sleep file you created earlier.