diff --git a/performance/throughput-fanout-test b/performance/throughput-fanout-test new file mode 100644 index 0000000..cac4b05 --- /dev/null +++ b/performance/throughput-fanout-test @@ -0,0 +1,73 @@ +#!/bin/bash + +usage () { + cat >&2 <&2 <&2 <$cfg <$cfg < - em2 + $nwif + $loopback 500kB - ${ASYNC:-0} + ${async:-0} + 3s @@ -42,24 +84,37 @@ if [ ! -x bin/ThroughputPublisher -o ! -x bin/ThroughputSubscriber -o ! -x $ethl exit 1 fi -mkdir throughput-result || { echo "failed to create throughput-result directory" >&2 ; exit 1 ; } +[ -d $resultdir ] || { echo "output directory $resultdir doesn't exist" >&2 ; exit 1 ; } + +if $provision ; then + echo "provisioning ..." + 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 + done +fi export CYCLONEDDS_URI=file://$PWD/$cfg -scp $cfg $remote:$PWD || { echo "failed to copy $cfg to $remote:$PWD" >&2 ; exit 1 ; } +for r in $pubremote "$@" ; do + scp $cfg $r:$remotedir || { echo "failed to copy $cfg to $remote:$PWD" >&2 ; exit 1 ; } +done -for async in 0 1 ; do - for mode in -1 0 1 ; do +for async in $asynclist ; do + export async + for mode in $modelist ; do echo "======== ASYNC $async MODE $mode =========" + cat > run-publisher.tmp < pub.log & ppid=\$! top -b -d1 -p \$ppid >> pub-top.log & tpid=\$! - sleep 20 + sleep $timeout kill \$tpid kill -2 \$ppid wait \$ppid @@ -67,24 +122,38 @@ for size in 0 16 32 64 128 256 ; do done wait EOF - scp run-publisher.tmp $remote:$PWD || { echo "failed to copy $cfg to $remote:$PWD" >&2 ; exit 2 ; } - - export ASYNC=$async - - outdir=throughput-result/data-async$async-mode$mode + scp run-publisher.tmp $pubremote:$remotedir || { echo "failed to copy $cfg to $remote:$PWD" >&2 ; exit 2 ; } + killremotesubs="" + if [ $# -gt 0 ] ; then + cat > run-subscriber.tmp < /dev/null & +echo \$! +EOF + for r in "$@" ; do + scp run-subscriber.tmp $r:$remotedir + rsubpid=`ssh $r ". $remotedir/run-subscriber.tmp"` + killremotesubs="$killremotesubs ssh $r kill -9 $rsubpid &" + done + fi + + outdir=$resultdir/data-async$async-mode$mode mkdir $outdir rm -f sub-top.log - $ethload em2 1000 > $outdir/sub-ethload.log & lpid=$! + $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=$! tail -f $outdir/sub.log & xpid=$! - ssh $remote ". $PWD/run-publisher.tmp" + ssh $pubremote ". $remotedir/run-publisher.tmp" kill $tpid kill -2 $spid + eval $killremotesubs sleep 1 kill $lpid $xpid wait - scp $remote:$PWD/{pub-top.log,pub.log} $outdir + scp $pubremote:$remotedir/{pub-top.log,pub.log} $outdir done done diff --git a/performance/throughput-test-extract b/performance/throughput-test-extract index b297907..9f16ff3 100755 --- a/performance/throughput-test-extract +++ b/performance/throughput-test-extract @@ -7,16 +7,18 @@ my @dirs = ("async0-mode-1", "async0-mode0", "async0-mode1", my $dataset = 0; my $basedir = "throughput-result"; +$basedir = $ARGV[0] if @ARGV== 1; +my $load_threshold = 20; for my $dir (@dirs) { my @loads = (); - + { - open LH, "< $basedir/data-$dir/sub-ethload.log" or die "can't open $basedir/data-$dir/sub-ethload.log"; + open LH, "< $basedir/data-$dir/sub-ethload.log" or next; # die "can't open $basedir/data-$dir/sub-ethload.log"; my @curload = (); while () { - die unless /^r +([0-9.]+).*\( *(\d+)/; - push @curload, $2 if $1 > 20; - if (@curload && $1 < 20) { + next unless /^r +([0-9.]+).*\( *(\d+)/; + push @curload, $2 if $1 > $load_threshold; + if (@curload && $1 < $load_threshold) { push @loads, median (@curload); @curload = (); } @@ -24,8 +26,8 @@ for my $dir (@dirs) { push @loads, median (@curload) if @curload; close LH; } - - open FH, "< $basedir/data-$dir/sub.log" or die "can't open $basedir/data-$dir/sub.log"; + + open FH, "< $basedir/data-$dir/sub.log" or next; # die "can't open $basedir/data-$dir/sub.log"; print "\n\n" if $dataset++; print "# mode $dir\n"; print "# payloadsize rate[samples/s] appl.bandwidth[Mb/s] raw.bandwidth[Mb/s]\n"; @@ -36,9 +38,6 @@ for my $dir (@dirs) { my $psz_cur = $1; my $rate_cur = $2; $psz = $psz_cur unless defined $psz; if ($psz != $psz_cur) { - # this is a bit yucky: scan the ethload for the next set of substantially-above-zero numbers - # where "substantially-above-zero" is defined as > 20%, cos that seems to work fine on a - # quiescent network my $load = shift @loads; my $rate = median (@rate); printf "%d %f %f %f\n", $psz, $rate, $rate * (8 + $psz) / 125e3, $load / 125e3;