-
Notifications
You must be signed in to change notification settings - Fork 389
/
Copy pathwdt_mixed_benchmark.sh
executable file
·84 lines (72 loc) · 2.45 KB
/
wdt_mixed_benchmark.sh
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
#! /bin/sh
# This script is mostly copied from wdt_e2e_test script. It has the same set up
# procedure. It is modified to support windtunnel integration.
# TODO: refactor this and e2e script to remove duplication of set up code
# TEST_COUNT is an environment variable. It is set up by the python benchmarking
# script.
if [ -z $TEST_COUNT ]; then
TEST_COUNT=1
fi
WDTBIN_OPTS="-minloglevel=0 -num_ports=8 -enable_checksum=false"
if [ -z "$1" ]; then
WDTBIN="_bin/wdt/wdt $WDTBIN_OPTS"
else
WDTBIN="$1 $WDTBIN_OPTS"
fi
CLIENT_PROFILE_FORMAT="%Uuser %Ssystem %Eelapsed %PCPU (%Xtext+%Ddata \
%Mmax)k\n%Iinputs+%Ooutputs (%Fmajor+%Rminor)pagefaults %Wswaps\nCLIENT_PROFILE %U \
%S %e"
SERVER_PROFILE_FORMAT="%Uuser %Ssystem %Eelapsed %PCPU (%Xtext+%Ddata \
%Mmax)k\n%Iinputs+%Ooutputs (%Fmajor+%Rminor)pagefaults %Wswaps\nSERVER_PROFILE %U \
%S %e"
BASEDIR=/dev/shm/tmpWDT
mkdir -p $BASEDIR
DIR=`mktemp -d --tmpdir=$BASEDIR`
echo "Testing in $DIR"
pkill -x wdt
mkdir $DIR/src
cp -R wdt folly $DIR/src
for size in 1k 64K 512K 1M 16M 256M 512M
do
base=inp$size
echo dd if=/dev/... of=$DIR/src/$base.1 bs=$size count=1
dd if=/dev/zero of=$DIR/src/$base.1 bs=$size count=1
for i in {2..8}
do
cp $DIR/src/$base.1 $DIR/src/$base.$i
done
done
echo "done with setup"
for ((i = 1; i <= TEST_COUNT; i++))
do
TWO_PHASE_ARG=""
# every other run will be two_phases
[ $(($i % 2)) -eq 0 ] && TWO_PHASE_ARG="-two_phases"
/usr/bin/time -f "$SERVER_PROFILE_FORMAT" $WDTBIN -directory $DIR/dst$i > \
$DIR/server$i.log 2>&1 &
# wait for server to be up
#while [ `/bin/true | nc $HOSTNAME 22356; echo $?` -eq 1 ]
#do
# echo "Server not up yet...`date`..."
# sleep 0.5
#done
#echo "Server is up on $HOSTNAME 22356 - `date` - starting client run"
/usr/bin/time -f "$CLIENT_PROFILE_FORMAT" $WDTBIN -directory $DIR/src \
-destination $HOSTNAME $TWO_PHASE_ARG |& tee $DIR/client$i.log
echo -n e | nc -4 $HOSTNAME 22356
rm -rf $DIR/dst$i
THROUGHPUT=`awk 'match($0, /.*Total sender throughput = ([0-9.]+)/, res) \
{print res[1]} END {}' $DIR/client$i.log`
echo "THROUGHPUT $THROUGHPUT"
TRANSFER_TIME=`awk 'match($0, /.*Total sender time = ([0-9.]+)/, res) \
{print res[1]} END {}' $DIR/client$i.log`
echo "TRANSFER_TIME $TRANSFER_TIME"
done
echo "Server logs:"
for ((i = 1; i <= TEST_COUNT; i++))
do
cat $DIR/server$i.log
done
find $DIR -type d | xargs chmod 755 # cp -r makes lib/locale not writeable somehow
echo "Deleting $DIR"
rm -rf $DIR