NQE lets you put to use the unused cycles on servers generally reserved for interactive use. This process is sometimes called cycle stealing . This chapter describes how to use the csuspend(8) command to enable or disable batch work, depending on interactive use. The following topics are discussed:
The syntax of the csuspend command is as follows:
csuspend [ -i value] [-l loopcount] [-o value] [ -p period] [-s] [ -t interval]
The options are described as follows:
Specifies the input character rate (in bytes) that is compared to the input character rate of sar -y. If the current tty input rate on the server equals or exceeds value, csuspend initiates suspension of batch activity. If the current tty input rate on the server is less than value, csuspend initiates resumption of batch activity. If you omit value, the default is 1.
Specifies the number of periods for which sar collects interactive activity data to determine if NQE will resume, be suspended, or continue to be suspended. The default number of periods ( loopcount) is 7. See the -p period option for information about specifying the length of a period.
Specifies the output character rate (in bytes) that is compared to the output character rate of sar -y. If the current tty input rate on the server equals or exceeds value, csuspend initiates suspension of batch activity. If the current tty input rate on the server is less than value, csuspend initiates resumption of batch activity. If you omit value, the default is 100.
Specifies the length of time (in seconds) that sar collects interactive activity data. The default period is 10 seconds. The minimum setting allowed for period is 5 seconds; if period is set to less than 5, it is automatically set to 5 seconds.
Specifies that the NLB object NLB_BSUSPEND attribute is set to YES when batch activity is suspended and NO when batch activity is resumed. NLB policies can use this value to distribute work to the server. The default is not to update the NLB database.
Specifies the interval (in seconds) that csuspend waits before it begins to check tty status. The check of tty status takes 60 seconds. The default value to wait between checks is 10 seconds.
The csuspend command uses sar to monitor interactive terminal session (tty) activity on a specific server. You must invoke csuspend on the server. If tty activity equals or exceeds the input or output thresholds set by using the -i or -o options, NQE suspends NQS batch activity. All queues are disabled, and no additional batch work is accepted. This process allows interactive users the full use of the server. When interactive activity drops below the thresholds specified, batch jobs are resumed. Using the -l and -p options gives an administrator greater control over how sar is used and the frequency of the check on whether to suspend or start NQE.
To use csuspend in Network Load Balancer (NLB) policies, invoke it with the -s option. Using this option ensures that the NLB server is aware when NQS is suspended.
The csuspend command runs in a scan loop until the command is terminated with a CONTROL-C or the kill-15 signal. It is often run in the background with standard output (stdout) and standard error (stderr) directed to a file.
The csuspend utility has no log file; by default, stdout and stderr are written to the terminal screen. If you want to log csuspend activity, redirect the output to a file.
When you stop csuspend, it resets queue states and exits. Even if the NQS server is shut down (by using nqestop(8) or qstop(8)), csuspend continues to run. When NQS is started (by using nqeinit(8) or qstart(8)), csuspend will recognize it.
|Note:: nqeinit and nqestop do not start or stop the csuspend process.|
When csuspend detects interactive use, it performs the following functions:
Reports tty input and output rates.
Disables and suspends all pipe queues on the server.
Disables and suspends all batch queues on the server.
Suspends all running batch requests.
Logs a suspend message to the request's job log.
If you used the -s option, the NLB object NLB_BSUSPEND attribute is set to YES.
When csuspend detects cessation of interactive use, it performs the following functions:
Reports tty input and output rates.
Resumes all running batch requests.
Resumes and enables all batch queues on the server.
Resumes and enables all pipe queues on the server.
Logs a resume message to the request's job log.
If you used the -s option, the NLB object NLB_BSUSPEND attribute is set to NO.
The csuspend command uses the following commands and files; they must be present on the server on which you invoke csuspend:
If you use the -s option, the nlbconfig(8) command and the NLB must be available.
Because csuspend needs access to NQS spool directories and uses qmgr(8) commands, you must invoke it from root.
Because csuspend is a ksh script, you can tailor it for individual site and server needs. The default values for its options appear after the initial comment lines at the start of the script file ($NQE_ETC/csuspend). To change the defaults or parts of the command logic, edit this file.
The following example invokes csuspend and places it in the background.
nohup csuspend -i 5 -o 50 -s -t 30 &
If the sar -y tty input character count equals or exceeds 5 (set by using -i), or if the output character count equals or exceeds 50 (set by using -o), batch request are suspended. When the rates fall below these values, batch request are resumed. The NLB_BSUSPEND attribute is updated (set by using -s). csuspend examines interactive tty activity every 30 seconds.
The following example invokes csuspend with all default values, which are echoed to stdout:
# csuspend Mar 30 23:50:58 - csuspend initiated for nqe server latte Mar 30 23:50:58 - using options: i=1,o=100,s=NO,t=10 Mar 30 23:50:58 - using NQE in /usr Mar 30 23:50:58 - using NLB server latte Mar 30 23:52:09 - auto resume processing cycle initiated Mar 30 23:52:09 - input character rate=0, output character rate=0 Mar 30 23:52:10 - found 1 batch queues to process Mar 30 23:52:10 - processing batch queue nqebatch Mar 30 23:52:11 - found 2 pipe queues to process Mar 30 23:52:11 - processing pipe queue nqenlb Mar 30 23:52:12 - processing pipe queue gate (character input occurs) Mar 31 08:07:28 - auto suspend processing cycle initiated Mar 31 08:07:28 - input character rate=4, output character rate=0 Mar 31 08:07:29 - found 2 pipe queues to process Mar 31 08:07:29 - processing pipe queue nqenlb Mar 31 08:07:30 - processing pipe queue gate Mar 31 08:07:31 - found 1 batch queues to process Mar 31 08:07:31 - processing batch queue nqebatch
The following example uses the -l and -p options to suspend or enable batch processing based upon the interactive use as determined by calls to sar.
csuspend -l 11 -p 60 &
If period is set to 60 and loopcount is set to 11, sar collects data over a 60-second period, and if the interactive activity is low enough during 10 (11 minus 1) periods, then NQE resumes. Otherwise, NQE is suspended or remains suspended.