Previous Next Contents Index


Chapter 13

Balancing User-Request Loads

This chapter describes load balancing, which optimizes the ability of each Netscape Application Server (NAS) to process users' requests by keeping those requests balanced among several NAS machines.

This chapter contains the following topics:


How Load Balancing Works
Load balancing sends user requests to the server with the least load, directing requests away from servers too busy to handle additional requests.

For example, if you find that many users access an application during peak usage hours, you can duplicate the application's components, such as AppLogics and servlets, on several Netscape Application Server (NAS) machines and enable load balancing. As one NAS machine reaches its optimal handling capacity, subsequent requests are sent to another NAS machine with duplicate application components. With multiple servers handling requests, you can increase response time.

The distribution of requests across multiple NAS machines is monitored and assigned by a load-balancing service built into each instance of NAS. The load-balancing service determines which NAS machine is best suited to handle a request by comparing servers based on the following two values:

Exchanging Load Balancing Information There is one load-balancing service in each instance of NAS. Each load-balancing service calculates the Server Load and Application Component Performance values for the server that hosts the load-balancing service. The load balancer then broadcasts, at the broadcast interval, its calculated values to the load-balancing services of the other NAS machines in the enterprise.

You can set the broadcast time intervals for each load-balancing service. For more information, see Adjusting Update and Broadcast Intervals.

Each load-balancing service calculates which NAS machine is currently able to most efficiently process new requests. This decision is made for each distributed application component. A list of available servers for each component is maintained by the load-balancing service.

The NAS machine best suited to process requests for an application component is ranked first in the list, followed by, in order, the other servers that are able to process requests for that component. The load-balancing service updates this order each time it receives a broadcast from another NAS machine or re-calculates its own server's values. The other servers are backups to the first server and the first server can forward a request to one of the other servers at any time.

NAS machines can pass requests to more capable servers up to a maximum number of hops. When an application component reaches that maximum number, it must be processed by the server to which the component was last passed. For information about setting the maximum number of hops, see Adjusting Update and Broadcast Intervals.

Load Balancing and Network Traffic
Only NAS machines that have enabled load balancing exchange load balancing information. Each server sends about 128 bytes of information when it broadcasts its calculated values. This value does not include network packet overhead. If a request is routed to another NAS machine, the hop size is at least 16 bytes, but could be more depending on the number of ValList variables.

All NAS machines in your enterprise that are configured for load balancing exchange Server Load values. In contrast, the Application Component Performance values are exchanged only with NAS machines hosting and distributing requests for the same application components.

Requirements for Load Balancing Before your application is load balanced, the following requirements must be met:

For information about enabling load balancing, see Hosting and Deploying Applications for Load Balancing.


Using the Load Balancer Plug-in
The load balancer plug-in is a component of the web connector plug-in. The load-balancing service within an instance of Netscape Application Server (NAS) communicates with the load balancer plug-in to provide information to the web connector about where to forward an application request.

The web connector plug-in defaults to sending application requests to one NAS machine. In a multiple-server enterprise where load balancing is being used, sending all requests to one server is not effective. It creates a potential bottleneck. Using the load balancer component, the web connector can determine, for each request, which NAS machine should process that request, thereby eliminating the bottleneck.

The load balancer plug-in is installed and configured automatically with the web connector plug-in. For more information about configuring the web connector plug-in, see Configuring the Web Connector Plug-In.


What Is Sticky Load Balancing?
If requests within the same session are processed by more than one Netscape Application Server (NAS) machine or process, session information that cannot be distributed is lost. Therefore, certain application components are marked for session or "sticky" load balancing and processed on the same server, thereby eliminating the loss of session information.

When an application component is marked for sticky load balancing, it is processed by the same NAS machine or process where it is initially invoked. For example, an application component called ShopCart is duplicated on two application servers for load balancing, Server A and Server B. If ShopCart is invoked by Client 1 on Server B, all subsequent sticky requests for that ShopCart from Client 1 are processed on Server B only. In other words, ShopCart "sticks" to Server B for the duration of Client 1's session. However, at the same time, Client 2 may access ShopCart on Server A without affecting Client 1's use of ShopCart on Server B. This maintains the integrity of state and session information for an application component that does not distribute session information.

When to Use Sticky Load Balancing Sticky load balancing is necessary for application components that have interdependencies, but are running in a distributed environment. Such application components typically have the following characteristics:

For example, a heavily used, pre-existing application is ported to run on NAS. Because the application is heavily used, it is distributed across several NAS machines to increase availability. When a user makes a request that invokes a sticky application component, the load-balancing service determines which NAS machine should handle that request. Once that server is chosen, all subsequent requests that use sticky application components are handled by that server. If that server becomes burdened with many users' requests, the load balancer forwards new requests to another NAS machine and that server processes all new session requests. This maintains an effective degree of load balancing.

Enabling Sticky Load Balancing Enable sticky load balancing if there are multiple processes running on a NAS machine and certain application components cannot distribute session and state information.

To enable sticky load balancing, perform the following steps:

  1. On the NAS Administrator toolbar, click the Application button to open the Application window.
  2. In the left pane of the Application window, select the server where you want to enable sticky load balancing.
  3. Open the application group that contains the application component or components for which you want to enable sticky load balancing.

  4. In the right pane of the Application window, select the application component for which you want to enable sticky load balancing.
  5. In the Sticky LB column, click the checkbox for the selected application component.

  6. Repeat steps 4 and 5 for each application component where you want to enable sticky load balancing.
  7. Click Toggle Sticky LB to select or deselect all Sticky LB checkboxes.

Selecting a Load Balancing Method
When configuring your server for load balancing, you must choose a load balancing method. Each method provides a different way to decide "who" makes the load balancing decisions. In other words, are load balancing decisions left to the server itself or does the web server plug-in make the decisions?

If load balancing decisions are left to Netscape Application Server (NAS), the application server uses a combination of hardware resource profiles (including CPU load and disk I/O) and Request Execution profiles (including result caching and servlet execution rate) to load balance individual requests. Server and request statistics are communicated from one NAS machine to another in a cluster via multicasting. Multicasting gives more control to the administrator, and is suitable for sophisticated scenarios.

If load balancing is left to the web server plug-in, the only factor considered in load balancing is response time as seen by the plug-in. The plug-in gathers response-time data as requests enter and leave the plug-in, then uses this data to load balance future requests. Since there is no inter-process communication involved and per-request resource usage is not factored into the load-balancing decisions, this is a simpler method than server-based load balancing.

Leaving load balancing decisions to the web server plug-in requires you to choose between two types of plug-in methods: load balancing by per-component response time or load balancing by per-server response time. Per-component response time is a NAS machine's average response time for a specific application component. Per-server response time is a NAS machine's average response time across all the application components that machine processes.

Use the per-component method to enable richer, more detailed load balancing decisions, keeping in mind that this scenario involves a little more overhead than the per-server method. The per-component method is best suited to situations where one application component has a response time that varies widely from server to server, while the per-server method is best in situations where an application component has a similar response time from server to server.


Adjusting Load Balancing Weight Factors
If you decide Netscape Application Server (NAS) -- not the web server plug-in --will make the load-balancing decisions for your enterprise, the load-balancing service then decides which NAS machine should process a request based on the weight factors you specify for the Server Load and Application Component Performance criteria. You set these factors using the NAS Administrator tool's Load Balancing window. When determining weight factors, you must decide how important each criteria is for keeping your applications running optimally.

The weight factors in NAS Administrator are initially set to default values based on the most typical applications that run on a NAS machine. You can adjust these factors for either Server Load criteria or Application Component criteria to optimize your specific application.

Adjusting Weight Factors for Server Load Criteria The Server Load value quantifies the load on a NAS machine while the server is processing users' requests. This value is calculated for each NAS machine by the load-balancing service within the respective server. You can adjust the weight factors for Server Load criteria to optimize how application requests are distributed across multiple NAS machines based on system resources.

The Server Load value is used as one of the criterion for calculating the Application Component Performance value. The Server Load criteria are described in the following table:

Server load criteria
Description
CPU Load
The average percentage of time all processors in a computer are in use.
Disk Input/Output
The rate at which the system is issuing Read and Write operations to the hard disk drive.
Memory Thrash
The number of pages read from or written to the hard disk drive to resolve memory references to pages that were not in memory at the time of the reference.
Number of Requests Queued
The number of user and application requests a server is currently processing.
Server Response Time
Average response time from a specific server for all application components.

Each Server Load criterion is multiplied with a weight factor you set. That value is averaged with the other values to determine the final Server Load value. This value is then used as one of the Application Component Performance criteria.

To adjust the weight factors for Server Load criteria, perform the following steps:

  1. On the NAS Administrator toolbar, click the Load Balancing button to open the Load Balancing window.
  2. Click the Server Load tab.
  3. In the left pane, select the server for which you want to adjust the weight factors.

  4. In the right pane of the Load Balancing window, select a load balancing method from the Load Balancing drop-down box.
  5. In the right pane of the Load Balancing window, use the sliding scale markers to adjust the weight factor for each criterion.
  6. When finished, click Apply Changes to save the settings.
Adjusting Weight Factors for Application Component Performance Criteria The Application Component Performance value represents the performance of the application components running on a NAS machine. This value is calculated for each application component participating in load balancing. Load balancing then occurs on an application component basis and increases distribution.

The Application Component Performance value includes five application criteria. The load-balancing service compares NAS machines based on the weight factor you assign for each application criterion. The server with the highest total value is chosen to process requests for that application component. The Application Component Performance criteria are described in the following table:

Application Component Performance Criteria
Description
Server Load
The value calculated for all Server Load criteria.
Cached Results Available
A flag that signals whether the results of the application component are cached. A user's request is typically processed faster when the application component's results are cached.
Lowest Average Execution Time
The time with which an application component takes to run on each NAS machine.
Most Recently Executed
The server that most recently ran an application component. The system on which the server is running might have cached application data, resulting in a faster execution time if that component were to be run again soon.
Fewest Executions
The number of times the application component ran on a NAS machine. The goal of load balancing is to equally distribute requests among all servers in the enterprise. Therefore, the server that has run the application component the least number of times is most preferred.
Application Component Response Time
Average response time from a specific server for a specific application component.

Each application criterion is multiplied by a weight factor you set. Each value is then averaged to determine the final Application Component Performance value. The final value is used by the load-balancing service to determine which NAS machine is best able to handle new users' requests.

To adjust the weight factors for Application Component Performance criteria, perform the following steps:

  1. On the NAS Administrator toolbar, click the Load Balancing button to open the Load Balancing window.
  2. Click the Application Component Criteria tab.
  3. In the left pane, select the server for which you want to adjust the weight factors.

  4. In the right pane of the Load Balancing window, select a load balancing method from the Load Balancing drop-down box.
  5. In the right pane of the Load Balancing window, use the sliding scale markers to adjust the weight factor for each criterion.
  6. When finished, click Apply Changes to save the settings.

Adjusting Update and Broadcast Intervals
You can set the time at which a NAS machine updates the Server Load and Application Component Performance criteria. If these values change frequently and drastically, it is useful to update the values often. Unfortunately, you increase the amount of work the NAS machine is doing by updating values frequently. You can save server resources by increasing the time between updates if the criteria values do not change often.

This theory applies to setting the broadcast intervals, as well; if values are changing often and drastically, the broadcast intervals should be short, updating servers often. This increases network traffic load, so it is important to find an optimal balance.

Broadcast and update intervals are relative to the Base Broadcast/Update Interval. This is the interval at which the load-balancing service "wakes up" and performs any updates, checks to see if any updates were received, and broadcasts any new values.

Broadcast and update intervals that are even multiples of the base interval are invoked when the load-balancing service "wakes up." In other words, if the base value is 300 seconds, and the Server Load and Application Component Criteria broadcast intervals are at 900 seconds each, these values are broadcast every third time the load-balancing service "wakes up." The other two times the load-balancing service awakens, it reevaluates the distribution order based on whether it received any updates from other NAS machines.

You can set update and broadcast intervals for several entities, as described in the following table:

Set interval for
Description
Base Broadcast/Update Interval
The interval at which the load-balancing service "wakes up."
Application Component Criteria
The interval at which the load-balancing service broadcasts the Application Component Performance value.
Server Load Criteria
The interval at which the load-balancing service broadcasts the Server Load value.
Server Load
The interval at which the load-balancing service updates the Server Load value.
CPU Load
The interval at which the load-balancing service updates the CPU Load value.
Disk Input/Output
The interval at which the load-balancing service updates the Disk I/O value.
Memory Thrash
The interval at which the load-balancing service updates the Memory Thrash value.
Number of Requests Queued
The interval at which the load-balancing service updates the Number of Requests Queued value.
Max Hops
The maximum number of times a request is allowed to be passed between servers.

To adjust the update and broadcast intervals, perform the following steps:

  1. Click the Load Balancing button on the NAS Administrator toolbar to open the Load Balancing window.
  2. Click the Advanced Settings tab.
  3. In the left pane of the Load Balancing window, select the server for which you want to adjust the advanced settings.

  4. In the right pane of the Load Balancing window, select a load balancing method from the Load Balancing drop-down box.
  5. In the right pane of the Load Balancing window, under each interval parameter, set the time as a multiple of the base time for that parameter.
  6. In the Max Hops text area, specify the maximum number of times an application component is passed between servers.
  7. When finished, click Apply Changes to save your changes.

Changing the Multicast Host Address for Load Balancing
Change the multicast server host address and port number to balance application loads across networks, such as across cities. Within a network, the default address does not need to be changed unless you are experiencing a conflict.

To change the multicast host address, perform the following steps:

  1. Open the Netscape Registry Editor by typing kregedit at the command line.
  2. Open the following key:
  3. Double-click the MCastHost String value.
  4. For the value data, specify the IP address for the new host and click OK.
  5. Double-click the MCastPort DWORD value.
  6. For the value data, specify the port number for the new host and click OK.
  7. Close the editor.
 

© Copyright 1999 Netscape Communications Corp.