Starting the SPD Server Performance Server

Overview of Starting the Performance Server

The SPD Server Performance Server can be started in two different ways. The Performance Server can be invoked by command line, or it can be launched by calling an rc.perf script that is configured for your location's SPD Server installation.
The SPD Server Performance Server process is configured by default to output the captured performance data to the user's screen. To disable the user screen display, redirect stdout/stderr to /dev/null. Redirecting the screen output also makes it easier to run spdsperf in the background, or as an orphan.

Start Performance Server from Command Line

You can start the SPD Server Performance Server from a UNIX command line. SPD Server and the SAS Management Console applications must be running before you start the Performance Server. If SPD Server must be restarted, the SPD Server Performance Server must also be shut down and restarted after SPD Server is restarted. The Performance Server utility is not compatible with SPD Server releases that preceded SPD Server 4.4.
Usage:
spdsperf -g SMA -n NSP -s SNP -p PLP -l LOG [-i SEC] [-c CNT]
where
  • SMA is the shared memory address for the SPD Server Global Control Block (GCB). The GCB is an internal SPD Server data map that contains all of the options that are passed to the SPDSBase server when it starts. To get the value for the GCB address, SPD Server must be started. After the SPD Server Name Server starts the first SPDSBase process, issue a UNIX ps command and look in the output to view the address parameters that were passed to SPDSBase. The GCB shared memory address should be found in the ps output data.
  • NSP is the process-ID number of the SPD Server Name Server whose family of spawned processes you want to monitor
  • SNP is the process-ID number of the SPD Server SNET server.
  • PLP is the listening port number that SAS Management Console will use to contact the Performance Server
  • LOG is the path specification that you want to write the profile log to.
  • SEC is the optional property that specifies the number of seconds that transpire between instances of performance monitoring data captures. The permissible range for SEC property values is integers that are greater than or equal to 1, and less than or equal to the declared SPD Server MAXINT value.
  • CNT is the optional property that specifies the count, or number of performance monitoring data captures that you want the Performance Server to take. The permissible range for CNT property values is integers that are greater than or equal to 0, and less than or equal to the declared SPD Server MAXINT value. A CNT value of 0 requests an infinite number of data captures.

Start Performance Server from Rc.perf Script

You can also start the SPD Server Performance Server by calling the rc.perf script during start-up. The next section contains an rc.perf script that you can cut and paste into an editor of your choice, and customize for use with your SPD Server installation. SPD Server 4.5 also ships with a sample rc.perf script that you can modify. The sample rc.perf script is located in your SPD Server installation folders at:.../samples/perfmon/rc.perf
Either example file can be used to create your custom rc.perf script.
You must make the following changes when you customize your version of the rc.perf script:
  1. The sample script below uses the default SPD Server installation path of usr/local/spds
    If your SPD Server installation uses a custom path, you must update the INSTDIR path setting to update your installation path setting.
  2. You must update the UNIX environment setting for DISPLAY. This environmental variable tells the X server where to display the window for the Performance Server program.
  3. The sample script uses the default SAS Name Server port ( NSPORT) and SAS SNET port (SNPORT) assignments. If your SPD Server installation uses different NSPORT and SNPORT assignments, you must update the NSPORT and SNPORT settings in the sample script to the port addresses that are used in your SPD Server installation.
  4. The script uses the –PARGS setting to specify how many times the Performance Server should capture performance information snapshots before shutting down. The sample rc.spds script below uses a -PARGS setting of 0, which requests an infinite number of performance information captures. If you do not change the default number of information captures from 0 (infinity), you might want to modify your rc.killspds script to shut down the rc.perf process when you shut down SPD Server.

Sample Rc.perf Script

The sample code below is a typical rc.perf script that you can modify for use at your own site. Follow the instructions in the section above to customize the script for your SPD Server installation. To assist you, the values that you might need to change have been highlighted. It is recommended that you copy and paste the text below into a text editor of your preference, make your changes, and then save the file to your SPD Server installation in a location where the script can be called for execution.
#!/bin/ksh
#--------------------------------------------------------------------------
#
# PURPOSE:    Start the SPD Performance Profiler for the specified servers.
#
# PARAMETERS: version - Version of SPDS to build and run (e.g., dev, 403).
#
# NOTES:      Common optional parameters:
#               -nsport    overrides NSPORT for server.
#               -snport    overrides SNPORT for server.
#               -debug     use alternate port numbers for development.
#
#             The default repetition count for spdsperf is 3. This script
#             over-rides the default to run indefinitely. Supplying a -c
#             option to this script will over-ride this new default.
#
# HISTORY:    12Sep06 mjm Optimized for customer use.
#             02Aug06 mjm Created.
#
#--------------------------------------------------------------------------


#
# enable XPG4 versions of ps command on some platforms
#
export UNIX95=1


#
# initialize variables
#
NSPORT=6100
SNPORT=6101
DEBUG=
PARGS="-c 0"

#
# parse parameters
#
while [ $1 ]; do
    #echo "Parsing Option $1 of length ${#1}"
    case "$1" in
        -nsport) if [ $# -lt 2 ]; then
                     echo "$1 parameter value not specified"
                     exit 1
                     fi
                 NSPORT=$2
                 shift;;
        -snport) if [ $# -lt 2 ]; then
                     echo "$1 parameter value not specified"
                     exit 2
                     fi
                 SNPORT=$2
                 shift;;
        -debug)  DEBUG="YES";;
        -trace)  echo "********\n* Script: $0\n* Args: $*\n********"
                 set -x
                 trace="-trace"
                 echo "Script tracing turned on";;
        *)       echo "Found unknown arg, passing on to profiler."
                                 PARGS="$PARGS $1";;
        esac
    shift
    done

echo "NSPORT=$NSPORT"
echo "SNPORT=$SNPORT"
echo "DEBUG=$DEBUG"
echo "PARGS=$PARGS"


#
# Check for debug option
#
if [ -n "$DEBUG" ]; then
        NSPORT=9876
        SNPORT=9877
        echo "Using Debug Ports: NS=$NSPORT   SN=$SNPORT"
    fi


SSRVPID=$(ps -eo pid,ppid,args | grep spdsserv | grep 6100
  | tr -s "      " " " | sed -e "s/^ *//" | cut -d " " -f1)

SNETPID=$(ps -eo pid,ppid,args | grep spdssnet | grep 6101
  | tr -s "      " " " | sed -e "s/^ *//" | cut -d " " -f1)

SHMATID=$(ps -eo pid,ppid,args | grep spdsbase | grep $SSRVPID
  | tr -s "\t" " " | sed -ne "1s/^ *//p" | cut -d " " -f4)

echo "SPDSNSRV Pid: $SSRVPID"
echo "SPDSSNET Pid: $SNETPID"
echo "SHMATID:      $SHMATID"

INSTDIR=/usr/local/spds
PATH=$INSTDIR/bin
export PATH
LD_LIBRARY_PATH=$INSTDIR/bin
export LD_LIBRARY_PATH
LIBPATH=$INSTDIR/bin
export LIBPATH

# substitute user's display machine name below.
export DISPLAY=machine:0.0

#sleep 4
spdsperf -g $SHMATID -n $SSRVPID -s $SNETPID $PARGS