1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222
|
#!/bin/sh
#set -x
#
# This is a script to generate a quick "snapshot" of performance for a
# pair of nodes. At first, it will perform the following tests:
#
# TCP Stream test with 56KB socket buffers and 4KB sends
# TCP Stream test with 32KB socket buffers and 4KB sends
# TCP Request/Response test with 1 byte requests and 1 byte responses
# UDP Request/Response test with 1 byte requests and 1 byte responses
# UDP Request/Response test with 516 byte requests and 4 byte responses
# UDP Stream test with 32KB socket buffers and 4KB sends
# UDP Stream test with 32KB socket buffers and 1KB sends
#
# All tests will run for sixty seconds. Confidence intervals are used
# to insure the repeatability of the test. This means that the soonest
# the script will be finished is 21 minutes.
#
# This script takes two parameters. The first parm is the name of the
# remote host. It is a required parameter. The second will either
# enable or disable CPU utilization measurements. It is an optional
# parameter which defaults to no CPU utilization measurements.
#
# usage: snapshot_script hostname [CPU]
#
# mod 6/29/95 - echo progress information to stderr so that we can
# see forward progress even when the results are
# re-directed to a file
#
# mod 5/27/96 - switch from NETHOME to NETPERF and take the user's value
# if it is already set
#
# mod 8/12/96 - fix the default netperf command variable so it finds the
# executable and not the directory...
#
# First, let us set-up some of the defaults
#
# where is netperf installed, there are a few possible places:
NETPERF_CMD=${NETPERF_CMD:=/opt/netperf/netperf}
# there should be no more than two parms passed
if [ $# -gt 2 ]; then
echo "try again, correctly -> snapshot_script hostname [CPU]"
exit 1
fi
if [ $# -eq 0 ]; then
echo "try again, correctly -> snapshot_script hostname [CPU]"
exit 1
fi
# if there are two parms, parm one it the hostname and parm two will
# be a CPU indicator. actuall, anything as a second parm will cause
# the CPU to be measured, but we will "advertise" it should be "CPU"
if [ $# -eq 2 ]; then
REM_HOST=$1
LOC_CPU="-c"
REM_CPU="-C"
fi
if [ $# -eq 1 ]; then
REM_HOST=$1
fi
# at what port will netserver be waiting? If you decide to run
# netserver at a differnet port than the default of 12865, then set
# the value of PORT apropriately
#NETPERF_PORT="-p some_other_portnum"
NETPERF_PORT=${NETPERF_PORT:=""}
# How accurate we want the estimate of performance:
# maximum and minimum test iterations (-i)
# confidence level (99 or 95) and interval (percent)
STATS_STUFF="-i 10,3 -I 99,5"
# length in time of the test - should be 60 seconds
NETPERF_TIME=${NETPERF_TIME:=60}
# where is the bitbucket?
BITBUCKET="/dev/null"
# announce start of test
echo Netperf snapshot script started at `date` >&2
# If we are measuring CPU utilization, then we can save beaucoup time
# by saving the results of the CPU calibration and passing them in
# during the real tests. So, we execute the new CPU "tests" of netperf
# and put the values into shell vars.
case $LOC_CPU in
\-c) LOC_RATE=`$NETPERF_CMD $NETPERF_PORT -t LOC_CPU`;;
*) LOC_RATE=""
esac
case $REM_CPU in
\-C) REM_RATE=`$NETPERF_CMD $NETPERF_PORT -t REM_CPU -H $REM_HOST`;;
*) REM_RATE=""
esac
# We will perform three twenty second warm-up tests at this point, but
# we will not display the results of those tests. This is unlikely to
# make any difference in the results except right after a system
# reboot, but this is supposed to be rather "general." We will do a
# TCP stream and a TCP req/resp test
WARM_TIME="10"
$NETPERF_CMD $NETPERF_PORT -l $WARM_TIME -t TCP_STREAM -H $REM_HOST -- \
-s 32768 -S 32768 -m 4096 > ${BITBUCKET}
$NETPERF_CMD $NETPERF_PORT -l $WARM_TIME -t TCP_STREAM -H $REM_HOST -- \
-s 32768 -S 32768 -m 96 > ${BITBUCKET}
$NETPERF_CMD $NETPERF_PORT -l $WARM_TIME -t TCP_RR -H $REM_HOST -- \
-r 1,1 > ${BITBUCKET}
# The warm-ups are complete, so perform the real tests first, the
# stream tests, then the request/response
echo Starting 56x4 TCP_STREAM tests at `date` >&2
# a 56x4 TCP_STREAM test
echo
echo ------------------------------------
echo Testing with the following command line:
echo $NETPERF_CMD $NETPERF_PORT -t TCP_STREAM -l $NETPERF_TIME -H $REM_HOST \
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF -- \
-s 57344 -S 57344 -m 4096
echo
$NETPERF_CMD $NETPERF_PORT -t TCP_STREAM -l $NETPERF_TIME -H $REM_HOST \
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF -- \
-s 57344 -S 57344 -m 4096
echo
echo
# a 32x4 TCP_STREAM test
echo Starting 32x4 TCP_STREAM tests at `date` >&2
echo
echo ------------------------------------
echo Testing with the following command line:
echo $NETPERF_CMD $NETPERF_PORT -t TCP_STREAM -l $NETPERF_TIME -H $REM_HOST \
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF -- \
-s 32768 -S 32768 -m 4096
echo
$NETPERF_CMD $NETPERF_PORT -t TCP_STREAM -l $NETPERF_TIME -H $REM_HOST \
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF -- \
-s 32768 -S 32768 -m 4096
echo
echo
# a single-byte TCP_RR
echo Starting 1,1 TCP_RR tests at `date` >&2
echo
echo ------------------------------------
echo Testing with the following command line:
echo $NETPERF_CMD $NETPERF_PORT -t TCP_RR -l $NETPERF_TIME -H $REM_HOST \
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF -- \
-r 1,1
echo
$NETPERF_CMD $NETPERF_PORT -t TCP_RR -l $NETPERF_TIME -H $REM_HOST \
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF -- \
-r 1,1
echo
echo
echo Starting 1,1 UDP_RR tests at `date` >&2
echo
echo ------------------------------------
echo Testing with the following command line:
# a single-byte UDP_RR
echo $NETPERF_CMD $NETPERF_PORT -t UDP_RR -l $NETPERF_TIME -H $REM_HOST \
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF -- \
-r 1,1
echo
$NETPERF_CMD $NETPERF_PORT -t UDP_RR -l $NETPERF_TIME -H $REM_HOST \
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF -- \
-r 1,1
echo
echo
# a UDP_RR test much like tftp
echo Starting 512,4 UDP_RR tests at `date` >&2
echo
echo ------------------------------------
echo Testing with the following command line:
echo $NETPERF_CMD $NETPERF_PORT -t UDP_RR -l $NETPERF_TIME -H $REM_HOST \
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF -- \
-r 516,4
echo
$NETPERF_CMD $NETPERF_PORT -t UDP_RR -l $NETPERF_TIME -H $REM_HOST \
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF -- -r 516,4
# a 32x4 UDP_STREAM test
echo Starting 32x4 UDP_STREAM tests at `date` >&2
echo
echo ------------------------------------
echo Testing with the following command line:
echo $NETPERF_CMD $NETPERF_PORT -t UDP_STREAM -l $NETPERF_TIME -H $REM_HOST \
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF -- \
-s 32768 -S 32768 -m 4096
echo
$NETPERF_CMD $NETPERF_PORT -t UDP_STREAM -l $NETPERF_TIME -H $REM_HOST \
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF -- \
-s 32768 -S 32768 -m 4096
echo
echo
# a 32x1 UDP_STREAM test
echo Starting 32x1 UDP_STREAM tests at `date` >&2
echo
echo ------------------------------------
echo Testing with the following command line:
echo $NETPERF_CMD $NETPERF_PORT -t UDP_STREAM -l $NETPERF_TIME -H $REM_HOST \
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF -- \
-s 32768 -S 32768 -m 1024
echo
$NETPERF_CMD $NETPERF_PORT -t UDP_STREAM -l $NETPERF_TIME -H $REM_HOST \
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF -- \
-s 32768 -S 32768 -m 1024
echo
echo
# and that's that
echo Tests completed at `date` >&2
echo
|