Load balancing WebObjects applications

The WebObjects Adaptor includes a load balancing feature to ensure that WebObjects application requests are spread evenly across your network.

The example in this section assumes that WebObjects is installed on the computer hosting your Web server and on two other computers.

The following instructions show you how to use Terminal.app's command window to start up the WebObjects applications, modify the WebObjects.conf configuration file, and test the results.

  1. From <FirstHost>, in a command window, change directories to <NeXT_Root>/NextLibrary/WebObjects/Executables and start the two HelloWorld applications by entering

  2. From <SecondHost>, in a command window, change directories to <NeXT_Root>/NextLibrary/WebObjects/Executables and start HelloWorld and CyberWind by entering

  3. From <ServerHost>, in a command window, change directories to <NeXT_Root>/NextLibrary/WebObjects/Executables and start HelloWorld by entering

  4. On <ServerHost>, edit the file WebObjects.conf in your Web server's cgi-bin directory to look like this

  5. Using the same URL as before, try contacting your application

The WebObjects Adaptor will pick one of the four HelloWorld applications it knows about and try to contact it. If the application is busy serving someone else, the WebObjects Adaptor will wait. If the application died or was not started, the WebObjects Adaptor will fail the request and return its standard error message.

If your WebObjects application carries state for the client between requests, the generated HTML pages will contain the complete path to return to the exact application that served the given client in his previous request, with links such as

   http://<myServerHost>/cgi-bin/WebObjects/Examples/HelloWorld:33@<myServerHost>

and no load-balancing will be performed as long as the session lasts.

If your WebObjects application does not maintain state, the application will automatically return HTML pages with links such as

   http://<myServerHost>/cgi-bin/WebObjects/Examples/HelloWorld

so that the WebObjects Adaptor can perform load balancing on subsequent requests, possibly contacting a different application.

As there is a single instance of the application CyberWind, all requests for CyberWind will always go to this same application. If you experience too much traffic for this single instance, you can deploy it on other hosts as you did with HelloWorld.

The WebObjects Adaptor will contact both autostarted applications and load-balanced applications (started by hand) at all times, as long as they don't have the same names. When names conflict, the WebObjects Adaptor will pick load-balanced applications rather than any previously autostarted application.