Use ddsperf in perf scripts and update README

* the scripted throughput test originally used for the throughput graph
  in the README now uses ddsperf;

* a scripted latency test has been added;

* updated the README with the results of these tests (and so now gives
  easy access not only to throughput, but also to latency and memory
  usage, as well as to latency over GbE.

Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
Erik Boasson 2019-08-02 09:06:39 +02:00 committed by eboasson
parent 952029dba0
commit af19c5681c
7 changed files with 554 additions and 189 deletions

136
examples/perfscript/throughput-test Normal file → Executable file
View file

@ -1,45 +1,53 @@
#!/bin/bash
export nwif=eth0
bandwidth=1e9
remotedir="$PWD"
provision=false
asynclist="sync async"
modelist="listener polling waitset"
sizelist="0 20 50 100 200 500 1000 2000 5000 10000 20000 50000 100000 200000 500000 1000000"
timeout=30
loopback=true
resultdir="throughput-result"
usage () {
cat >&2 <<EOF
usage: $0 [OPTIONS] user@remote [user@remote...]
OPTIONS
-i IF use network interface IF (default: eth0)
-b 100|1000 network bandwidth (100Mbps/1000Gbps) for calculating load
% given load in bytes/second (default: 1000)
-i IF use network interface IF (default: $nwif)
-b 100|1000|B network bandwidth (100Mbps/1000Gbps or B bits/sec) for
calculating load % given load in bytes/second (default: 1000)
-d DIR use DIR on remote (default: PWD)
-p provision required binaries in DIR (default: false)
-p provision required binaries in DIR (default: $provision)
first ssh's in to try mkdir -p DIR, then follows up with scp
-t DUR run for DUR seconds per size (default 20)
-a ASYNCLIST run for delivery async settings ASYNCLIST (default: "0 1")
-m MODELIST run with subscriber mode settings MODELIST (default: "-1 0 1")
-s SIZELIST run for sizes in SIZELIST (default: "0 16 32 64 128 256")
-l LOOPBACK enable/disable multicast loopback (true/false, default: true)
-o DIR store results in dir (default: throughput-result)
-t DUR run for DUR seconds per size (default $timeout)
-a ASYNCLIST run for delivery async settings ASYNCLIST (default:
"$asynclist")
-m MODELIST run with subscriber mode settings MODELIST (default:
"$modelist")
-s SIZELIST run for sizes in SIZELIST (default: "$sizelist")
if SIZELIST is empty, it uses ddsperf's OU topic instead
-l LOOPBACK enable/disable multicast loopback (true/false, default: $loopback)
-o DIR store results in dir (default: $resultdir)
Local host runs ThroughputSubscriber, first remote runs ThroughputPublisher,
further remotes also run ThroughputSubscriber. It assumes these are
available in DIR/bin. It also assumes that ssh user@remote works without
requiring a password.
Local host runs "ddsperf" in subscriber mode, first remote runs it publisher
mode, further remotes also run subcribers. It assumes these are available in
DIR/bin. It also assumes that ssh user@remote works without requiring a
password.
EOF
exit 1
}
export nwif=eth0
bandwidth=1000
remotedir="$PWD"
provision=false
asynclist="0 1"
modelist="-1 0 1"
sizelist="0 16 32 64 128 256"
timeout=20
loopback=true
resultdir="throughput-result"
while getopts "i:b:d:pa:m:s:t:o:l:" opt ; do
case $opt in
i) nwif="$OPTARG" ;;
b) bandwidth="$OPTARG" ;;
b) case "$OPTARG" in
100) bandwidth=1e8 ;;
1000) bandwidth=1e9 ;;
*) bandwidth="$OPTARG" ;;
esac ;;
d) remotedir="$OPTARG" ;;
p) provision=true ;;
a) asynclist="$OPTARG" ;;
@ -53,7 +61,6 @@ while getopts "i:b:d:pa:m:s:t:o:l:" opt ; do
done
shift $((OPTIND-1))
if [ $# -lt 1 ] ; then usage ; fi
ethload=`dirname $0`/ethload
pubremote=$1
shift
@ -63,24 +70,27 @@ cat >$cfg <<EOF
<Domain>
<Id>17</Id>
</Domain>
<DDSI2E>
<General>
<NetworkInterfaceAddress>$nwif</NetworkInterfaceAddress>
<EnableMulticastLoopback>$loopback</EnableMulticastLoopback>
</General>
<Internal>
<Watermarks>
<WhcHigh>500kB</WhcHigh>
</Watermarks>
<SynchronousDeliveryPriorityThreshold>${async:-0}</SynchronousDeliveryPriorityThreshold>
<LeaseDuration>3s</LeaseDuration>
</Internal>
</DDSI2E>
<General>
<NetworkInterfaceAddress>$nwif</NetworkInterfaceAddress>
<EnableMulticastLoopback>$loopback</EnableMulticastLoopback>
<MaxMessageSize>65500B</MaxMessageSize>
<FragmentSize>4000B</FragmentSize>
</General>
<Internal>
<Watermarks>
<WhcHigh>500kB</WhcHigh>
</Watermarks>
<SynchronousDeliveryPriorityThreshold>\${async:-0}</SynchronousDeliveryPriorityThreshold>
<LeaseDuration>3s</LeaseDuration>
</Internal>
<Tracing>
<Verbosity>config</Verbosity>
</Tracing>
</CycloneDDS>
EOF
if [ ! -x bin/ThroughputPublisher -o ! -x bin/ThroughputSubscriber -o ! -x $ethload ] ; then
echo "some check for existence of a file failed on the local machine" >&2
if [ ! -x bin/ddsperf ] ; then
echo "bin/ddsperf not found on the local machine" >&2
exit 1
fi
@ -91,33 +101,35 @@ if $provision ; then
for r in $pubremote "$@" ; do
ssh $r mkdir -p $remotedir $remotedir/bin $remotedir/lib
scp lib/libddsc.so.0 $r:$remotedir/lib
scp bin/ThroughputPublisher bin/ThroughputSubscriber $r:$remotedir/bin
scp bin/ddsperf $r:$remotedir/bin
done
fi
topic=KS
[ -z "$sizelist" ] && topic=OU
export CYCLONEDDS_URI=file://$PWD/$cfg
for r in $pubremote "$@" ; do
scp $cfg $r:$remotedir || { echo "failed to copy $cfg to $remote:$PWD" >&2 ; exit 1 ; }
done
for async in $asynclist ; do
for async_mode in $asynclist ; do
case "$async_mode" in
sync) async=0 ;;
async) async=1 ;;
*) echo "$async_mode: invalid setting for ASYNC" >&2 ; continue ;;
esac
export async
for mode in $modelist ; do
echo "======== ASYNC $async MODE $mode ========="
for sub_mode in $modelist ; do
echo "======== ASYNC $async MODE $sub_mode ========="
cat > run-publisher.tmp <<EOF
export CYCLONEDDS_URI=file://$remotedir/$cfg
export async=$async
cd $remotedir
rm -f pub-top.log
for size in $sizelist ; do
for size in ${sizelist:-0} ; do
echo "size \$size"
bin/ThroughputPublisher \$size > pub.log & ppid=\$!
top -b -d1 -p \$ppid >> pub-top.log & tpid=\$!
sleep $timeout
kill \$tpid
kill -2 \$ppid
wait \$ppid
bin/ddsperf -D $timeout -T $topic pub size \$size > pub.log
sleep 5
done
wait
@ -129,7 +141,7 @@ EOF
export CYCLONEDDS_URI=file://$remotedir/$cfg
export async=$async
cd $remotedir
nohup bin/ThroughputSubscriber 0 $mode > /dev/null &
nohup bin/ddsperf -T $topic sub $sub_mode > /dev/null &
echo \$!
EOF
for r in "$@" ; do
@ -138,22 +150,18 @@ EOF
killremotesubs="$killremotesubs ssh $r kill -9 $rsubpid &"
done
fi
outdir=$resultdir/data-async$async-mode$mode
outdir=$resultdir/$async_mode-$sub_mode
mkdir $outdir
rm -f sub-top.log
$ethload $nwif $bandwidth > $outdir/sub-ethload.log & lpid=$!
bin/ThroughputSubscriber 0 $mode > $outdir/sub.log & spid=$!
top -b -d1 -p $spid >> $outdir/sub-top.log & tpid=$!
bin/ddsperf -d $nwif:$bandwidth -c -T $topic sub $sub_mode > $outdir/sub.log & spid=$!
tail -f $outdir/sub.log & xpid=$!
ssh $pubremote ". $remotedir/run-publisher.tmp"
kill $tpid
kill -2 $spid
kill $spid
eval $killremotesubs
sleep 1
kill $lpid $xpid
kill $xpid
wait
scp $pubremote:$remotedir/{pub-top.log,pub.log} $outdir
scp $pubremote:$remotedir/pub.log $outdir
done
done