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
|
#!/bin/sh
#
# This script runs a series of netperf tests intended to gather the
# raw material necessary to arrive at estimates for the cost of
# sending and receiving a TCP segment, the cost of each additional byte
# and the cost of each incremental segment.
#
# there are a number of data points gathered by this script - it might
# run for a considerable length of time.
#
# rick jones 4/99
#
if [ $# -gt 2 ]; then
echo "try again, correctly -> packet_byte_script hostname [CPU]"
exit 1
fi
if [ $# -eq 0 ]; then
echo "try again, correctly -> packet_byte_script hostname [CPU]"
exit 1
fi
# where is netperf
NETPERF_CMD=${NETPERF_CMD:=/opt/netperf/netperf}
# 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 NETPERF_PORT apropriately
# NETPERF_PORT="-p some_other_portnum"
NETPERF_PORT=${NETPERF_PORT:=""}
# The test length in seconds
NETPERF_TIME=${NETPERF_TIME:=20}
# How accurate we want the estimate of performance:
# maximum and minimum test iterations (-i)
# confidence level (99 or 95) and interval (percent)
NETPERF_STATS=${NETPERF_STATS:="-i 10,3 -I 99,5"}
# The socket sizes that we will be testing - using zero will let it
# be the system default.
NETPERF_SKTS=${NETPERF_SKTS:="0"}
# The request,response sizes that we will be using. The netperf
# command parser will treat "1" the same as "1,1" - I use 1,1 to
# remember that it is "request,response"
NETPERF_REQS=${NETPERF_REQS:="1 16 32 64 128 256 512 1024 \
1460 1461 2920 2921 4380 4381"}
NETPERF_RESP=${NETPERF_RESP:="1 16 32 64 128 256 512 1024 \
1460 1461 2920 2921 4380 4381"}
# if there are two parms, parm one it the hostname and parm two will
# be a CPU indicator. actually, 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
# 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 $PORT -t LOC_CPU`;;
*) LOC_RATE=""
esac
case $REM_CPU in
\-C) REM_RATE=`$NETPERF_CMD $PORT -t REM_CPU -H $REM_HOST`;;
*) REM_RATE=""
esac
# This disables header display
NO_HDR="-P 0"
NO_HDR=""
for SOCKET_SIZE in $NETPERF_SKTS
do
echo
echo ------------------------------------------------------
echo Testing with the following command line:
# we echo the command line for cut and paste to th database
echo $NETPERF_CMD $NETPERF_PORT -l $NETPERF_TIME -H $REM_HOST -t TCP_RR \
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $NETPERF_STATS --\
-s $SOCKET_SIZE -S $SOCKET_SIZE
echo
echo and these settings for send sizes $NETPERF_REQS
echo
for REQ in $NETPERF_REQS
do
# since we have the confidence interval stuff, we do not
# need to repeat a test multiple times from the shell
$NETPERF_CMD $NETPERF_PORT -l $NETPERF_TIME -H $REM_HOST $NO_HDR \
-t TCP_RR $LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $NETPERF_STATS --\
-r ${REQ},1 -s $SOCKET_SIZE -S $SOCKET_SIZE
NO_HDR="-P 0"
done
echo
echo ------------------------------------------------------
NO_HDR=""
echo Testing with the following command line:
# we echo the command line for cut and paste to th database
echo $NETPERF_CMD $NETPERF_PORT -l $NETPERF_TIME -H $REM_HOST -t TCP_RR \
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $NETPERF_STATS --\
-s $SOCKET_SIZE -S $SOCKET_SIZE
echo and these settings for response sizes $NETPERF_RESP
echo
for RESP in $NETPERF_RESP
do
# since we have the confidence interval stuff, we do not
# need to repeat a test multiple times from the shell
$NETPERF_CMD $PORT -l $NETPERF_TIME -H $REM_HOST $NO_HDR \
-t TCP_RR $LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $NETPERF_STATS --\
-r 1,${RESP} -s $SOCKET_SIZE -S $SOCKET_SIZE
NO_HDR="-P 0"
done
echo
echo ------------------------------------------------------
NO_HDR=""
echo Testing with the following command line:
# we echo the command line for cut and paste to th database
echo $NETPERF_CMD $NETPERF_PORT -l $NETPERF_TIME -H $REM_HOST -t TCP_STREAM\
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $NETPERF_STATS --\
-s $SOCKET_SIZE -S $SOCKET_SIZE
echo and these settings for response sizes $NETPERF_RESP
echo
for REQ in $NETPERF_REQS
do
# since we have the confidence interval stuff, we do not
# need to repeat a test multiple times from the shell
$NETPERF_CMD $PORT -l $NETPERF_TIME -H $REM_HOST $NO_HDR \
-t TCP_STREAM $LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $NETPERF_STATS --\
-m ${REQ} -s $SOCKET_SIZE -S $SOCKET_SIZE -D
NO_HDR="-P 0"
done
done
# The test length in seconds for the CRR test, which needs to be
# longer for a connect/request/response test
NETPERF_CRR_TIME=${NETPERF_CRR_TIME:=120}
# now we do the TCP_CRR test
echo
echo ------------------------------------------------------
echo $NETPERF_CMD $NETPERF_PORT -l $NETPERF_CRR_TIME -H $REM_HOST -t TCP_CRR\
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $NETPERF_STATS --\
-s $SOCKET_SIZE -S $SOCKET_SIZE
echo
$NETPERF_CMD $NETPERF_PORT -l $NETPERF_CRR_TIME -H $REM_HOST -t TCP_CRR\
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $NETPERF_STATS --\
-s $SOCKET_SIZE -S $SOCKET_SIZE
|