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