skip book previous and next navigation links
go up to top of book: HP OpenVMS Alpha Partitioning and Galaxy GuideHP OpenVMS Alpha Partitioning and Galaxy Guide
go to beginning of appendix: OpenVMS Galaxy CPU Load Balancer ProgramOpenVMS Galaxy CPU Load Balancer Program
 
go to next page: Example ProgramExample Program
end of book navigation links

CPU Load BalancerOverview  



The OpenVMS Galaxy CPU Load Balancer program is a privilegedapplication that dynamically reassigns CPU resources among instancesin an OpenVMS Galaxy.

The program must be run on each participating instance. Eachimage creates, or maps to, a small shared memory section and periodicallyposts information regarding the depth of that instance's COM queues.Based upon running averages of this data, each instance determinesthe most and the least busy instances. If these factors exist fora specified duration, the least busy instance having available secondaryprocessors reassigns one of its processors to the most busy instance,thereby effectively balancing processor usage across the OpenVMSGalaxy. The program provides command-line arguments to allow tuningof the load-balancing algorithm. The program is admittedly shy onerror handling.

This program uses the following OpenVMS Galaxy system services:

Service Description
SYS$CPU_TRANSITION
CPU reassignment
SYS$CRMPSC_GDZRO_64
Shared memory creation
SYS$SET_SYSTEM_EVENT
OpenVMS Galaxy event notification
SYS$*_GALAXY_LOCK_*
OpenVMS Galaxy locking

Because OpenVMS Galaxy resources are always reassigned viaa push model, where only the owner instance can release its resources,one copy of this process must run on each instance in the OpenVMSGalaxy.

This program can be run only in an OpenVMS Version 7.2 orlater multiple-instance Galaxy.

Required Privileges  

The CMKRNLprivilege is required to count CPU queues. The SHMEM privilege isrequired to map shared memory.

Build and Copy Instructions  

Compileand link the example program as described in the following section,or copy the precompiled image found in SYS$EXAMPLES:GCU$BALANCER.EXEto SYS$COMMON:[SYSEXE]GCU$BALANCER.EXE.

If your OpenVMS Galaxy instances use individual system disks,you need to perform this action for each instance.

If you change the example program, compile and link it asfollows:

$ CC GCU$BALANCER.C+SYS$LIBRARY:SYS$LIB_C/LIBRARY$ LINK/SYSEXE GCU$BALANCER

Startup Options  

You must establisha DCL command for this program. HP has provided a sample commandtable file for this purpose. To install the new command, enter thefollowing:

$ SET COMMAND/TABLE=SYS$LIBRARY:DCLTABLES -_$ /OUT=SYS$COMMON:[SYSLIB]DCLTABLES GCU$BALANCER.CLD
This command inserts the new command definition into DCLTABLES.EXEin your common system directory. The new command tables take effectwhen the system is rebooted. If you would like to avoid a reboot,enter the following:
$ INSTALL REPLACE SYS$COMMON:[SYSLIB]DCLTABLES.EXE
After this command, you need to log out and log back in touse the command from any active processes. Alternatively, if youwould like to avoid logging out, enter the following from each processyou would like to run the balancer from:
$ SET COMMAND GCU$BALANCER.CLD
Once your command has been established, you may use the variouscommand-line parameters to control the balancer algorithm.
$ CONFIGURE BALANCER[/STATISTICS] x y time
In this command, x is the number of loadsamples to take, y is the number of queuedprocesses required to trigger resource reassignment, and time isthe delta time between load sampling.

The /STATISTICS qualifier causes the program to display acontinuous status line. This is useful for tuning the parameters.This output is not visible if the balancer is run detached, as isthe case if it is invoked via the GCU. The /STATISTICS qualifieris intended to be used only when the balancer is invoked directlyfrom DCL in a DECterm window. For example:

$ CONFIG BAL 3 1 00:00:05.00
This starts the balancer, which samples the system load every5 seconds. After three samples, if the instance has one or moreprocesses in the COM queue, a resource (CPU) reassignment occurs,giving this instance another CPU.
 
go to next page: Example ProgramExample Program