JBoss.orgCommunity Documentation

Chapter 15. Load Balancing Demo Application

15.1. Overview
15.2. Basic Usage
15.3. Client Driver Configuration Options
15.4. Load Generation Scenarios

The mod_cluster distribution includes a demo application that helps demonstrate how different server-side scenarios affect the routing of client requests by the load balancer. The demo application is located in the mod_cluster distribution's demo directory.

The demo application consists of two components:

Note that the demo application does not actually depend on mod_cluster in any way. Its only dependency is on JBossWeb/Tomcat. [1] Consequently, the demo can be used to demonstrate the effect of different server-side scenarios on the routing decisions made by any load balancer, including mod_jk, mod_proxy or the various hardware load balancers.

Note also that this demo application is not intended to be used as a load testing tool; i.e. something that can demonstrate the maximum load a cluster configuration can handle. Using it as such has a good chance of showing you the maximum load the client can generate rather than the maximum load your cluster can handle.

To run the demo application:

  1. Unpack the mod_cluster distribution on your filesystem. Here we assume it has been unzipped to ~/mod_cluster or C:\mod_cluster.

  2. Install mod_cluster into your httpd server as described at Installation of the httpd part

  3. Install mod_cluster into your JBossAS/JBossWeb/Tomcat servers as described at Installation on the Java side

  4. In AS7 you have to set org.apache.tomcat.util.ENABLE_MODELER to true, Something like:

        <system-properties>
           <property name="org.apache.tomcat.util.ENABLE_MODELER" value="true"/>
        </system-properties>
              

  5. Start httpd and your JBossAS/JBossWeb/Tomcat servers

  6. Deploy the load-demo.war found in the distribution's demo/server folder to your JBossAS/JBossWeb/Tomcat servers.

  7. Start the demo application:

    1. On *nix:

      cd ~/mod_cluster/demo/client
      ./run-demo.sh

    2. On Windows:

      C:\>cd mod_cluster\demo\client
      C:\mod_cluster\demo\client>run-demo
  8. Configure the hostname and address of the httpd server, the number of client threads, etc and click the "Start" button. See Client Driver Configuration Options for details on the configuration options.

  9. Switch to the "Request Balancing" tab to see how many requests are going to each of your JBossAS/JBossWeb/Tomcat servers.

  10. Switch to the "Session Balancing" tab to see how many active sessions [2] are being hosted by each of your JBossAS/JBossWeb/Tomcat servers.

  11. Stop some of your JBossAS/JBossWeb/Tomcat servers and/or undeploy the load-demo.war from some of the servers and see the effect this has on load balancing.

  12. Restart some of your JBossAS/JBossWeb/Tomcat servers and/or re-deploy the load-demo.war to some of the servers and see the effect this has on load balancing.

  13. Experiment with adding artificial load to one or more servers to see what effect that has on load balancing. See Load Generation Scenarios for details.

Most of the various panels in application interface also present information on the current status on any client threads. "Total Clients" is the number of client threads created since the last time the "Start" button was pushed. "Live Clients" is the number of threads currently running. "Failed Clients" is the number of clients that terminated abnormally; i.e. made a request that resulted in something other than an HTTP 200 response.

The configuration of the client is driver is done via the application's "Clent Control" tab.

The panel includes the following options:

  1. Proxy Hostname: Hostname of the load balancer or the IP address on which it is listening for requests [3]

  2. Proxy Port: Port on which the load balancer is listening for requests [4]

  3. Context Path: Portion of the request URL that specifies the request is for the load-demo.war

  4. Session Life: Number of seconds a client thread should use a session before invalidating or abandoning it. Generally it is good to keep this to a small value; otherwise the use of session stickiness will prevent changes in server load from affecting the load balancer's routing decisions. With sticky sessions enabled (strongly recommended), it is the creation of a new session that allows the load balancer to try to balance load.

  5. Invalidate: Controls what the client thread should do when it stops using a session because Session Life has passed. If checked, the driver will send a request that results in the session being invalidated. If unchecked, the session will just be abandoned, and will continue to exist on the server until Session Timeout seconds have passed. In the future this will likely be changed to a percentage input, so X% can be invalidated, the rest abandoned.

  6. Session Timeout: Number of seconds a session can remain unused before the server is free to expire it. Unchecking Invalidate and setting a high value relative to Session Life allows a significant number of unused sessions to accumulate on the server.

  7. Num Threads: Number of client threads to launch. Each thread repeatedly makes requests until the "Stop" button is pushed or a request receives a response other than HTTP 200.

  8. Sleep Time: Number of ms the client threads should sleep between requests.

  9. Startup Time: Number of seconds over which the application should stagger the start of the client threads. Staggering the start advised as it avoids the unnatural situation where for the life of the demonstation all sessions start at about the same time and then are invalidated or abandoned at the same time. Staggering the start allows the load balancer to continually see new sessions and decide how to route them.

You can use the application's GUI to instruct individual servers to artificially generate various types of load, and then track how that load affects request and session balancing. Load generation is controlled via the application's "Server Load Control" tab.

The panel includes the following options:



[1] The demo's "Datasource Use" load generation scenario requires the use of JBoss Application Server.

[2] For purposes of this chart, a session is considered "active" if a client thread will ever again send a request associated with the session. When client threads stop using a session, they can either send a request to invalidate it or just abandon it by no longer including its session cookie in requests. After a session is abandoned, it will not be reflected in the "Session Balancing" chart, but it will continue to exist on the JBossWeb/Tomcat/JBoss AS server until it is removed due to timeout.

[3] The default value for this field is controlled by the mod_cluster.proxy.host system property, or localhost if not set. Editing the run-demo.sh or run-demo.bat file to change the -Dmod_cluster.proxy.host=localhost passed to java will allow you to avoid re-typing this value every time you launch the demo application.

[4] The default value for this field is controlled by the mod_cluster.proxy.port system property, or 8000 if not set. Editing the run-demo.sh or run-demo.bat file to change the -Dmod_cluster.proxy.port=8000 passed to java will allow you to avoid re-typing this value every time you launch the demo application.