-
Notifications
You must be signed in to change notification settings - Fork 0
/
runner_long.sh
executable file
·154 lines (125 loc) · 3.73 KB
/
runner_long.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
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
#!/bin/bash
SUITE=$1
LABEL=$2
DURATION=$3
THREADS=$4
TRIAL_COUNT=$5
DYNO="--dyno"
if [ "$SUITE" = "" ]
then
SUITE="sanity"
fi
if [ "$LABEL" = "" ]
then
LABEL=$SUITE
fi
if [ "$DURATION" = "" ]
then
DURATION=600
fi
if [ "$THREADS" = "" ]
then
THREADS="24"
fi
if [ "$TRIAL_COUNT" = "" ]
then
TRIAL_COUNT="1"
fi
MONGO_ROOT=/home/$USER
MONGO_SHELL=$MONGO_ROOT/mongo-perf-shell/mongo
if [ ! -f "$MONGO_SHELL" ]
then
echo $MONGO_SHELL does not exist
exit
fi
DBPATH=/data2/db
DBLOGS=/data3/logs/db
TARFILES=/data3/logs/archive
mkdir -p $DBPATH
mkdir -p $DBLOGS
mkdir -p $TARFILES
RH=32
for MOUNTS in $DBPATH $LOGPATH ; do
MOUNT_POINT="/"`echo $MOUNTS | cut -f2 -d"/"`
DEVICE=`df -P $MOUNT_POINT | grep $MOUNT_POINT | cut -f1 -d" "`
sudo blockdev --setra $RH $DEVICE
DEVICE=`echo $DEVICE | sed -r 's.^/dev/..'`
echo "noop" | sudo tee /sys/block/$DEVICE/queue/scheduler
done
NUM_CPUS=$(grep ^processor /proc/cpuinfo | wc -l)
for i in `seq 0 $[$NUM_CPUS-1]`
do
if [ -f /sys/devices/system/cpu/cpu$i/cpufreq ]
then
echo "performance" | sudo tee /sys/devices/system/cpu/cpu$i/cpufreq/scaling_governor
fi
done
MONGO_OPTIONS="--bind_ip 127.0.0.1"
EXTRA_OPTS="--testFilter='$SUITE' --reportInterval 10"
echo "never" | sudo tee /sys/kernel/mm/transparent_hugepage/enabled
echo "never" | sudo tee /sys/kernel/mm/transparent_hugepage/defrag
echo "0" | sudo tee /proc/sys/kernel/randomize_va_space
echo "0" | sudo tee /proc/sys/vm/swappiness
killall -w -s 9 mongod
for VER in "3.0.0-rc9" ; do
MONGOD=$MONGO_ROOT/mongodb-linux-x86_64-$VER/bin/mongod
if [ ! -f "$MONGOD" ]
then
echo $MONGOD does not exist
continue
fi
for STORAGE_ENGINE in "mmapv0" "mmapv1" "wiredTiger" ; do
for BENCHRUN_OPTS in "-c 8" "-c 1" "-m 8"; do
SE_SUPPORT=$($MONGOD --help | grep storageEngine | wc -l)
if [ "$SE_SUPPORT" = 1 ] && [ "$STORAGE_ENGINE" = "mmapv0" ]
then
continue
fi
if [ "$SE_SUPPORT" = 0 ] && [ "$STORAGE_ENGINE" != "mmapv0" ]
then
continue
fi
if [ "$SE_SUPPORT" == 1 ]
then
SE_OPTION="--storageEngine="$STORAGE_ENGINE
if [ "$STORAGE_ENGINE" == "wiredtiger" ] || [ "$STORAGE_ENGINE" == "wiredTiger" ]
then
WT_RC0=`$MONGOD --help | grep -i wiredTigerEngineConfig | wc -l`
WT_RC3=`$MONGOD --help | grep -i wiredTigerCheckpointDelaySecs | wc -l`
if [ "$WT_RC3" == 1 ]
then
SE_CONF="--wiredTigerCheckpointDelaySecs 14400"
elif [ "$WT_RC0" == 1 ]
then
SE_CONF="--wiredTigerEngineConfig checkpoint=(wait=14400)"
else
SE_CONF="--syncdelay 14400"
fi
else
SE_CONF="--syncdelay 14400"
fi
else
SE_OPTION=""
SE_CONF=""
fi
echo "3" | sudo tee /proc/sys/vm/drop_caches
rm -r $DBPATH/*
rm -r $DBLOGS/*
CMD="$MONGOD --dbpath $DBPATH --logpath $DBLOGS/server.log --fork $MONGO_OPTIONS $SE_OPTION $SE_CONF"
echo $CMD >> $DBLOGS/cmd.log
echo "" >> $DBLOGS/cmd.log
numactl --physcpubind=0-23 --interleave=all $CMD
sleep 20
CONFIG=`echo $BENCHRUN_OPTS| tr -d ' '`
LBL=$LABEL-$VER-$STORAGE_ENGINE$CONFIG
CMD="python benchrun.py -f testcases/* -t $THREADS -l $LBL --rhost 54.191.70.12 --rport 27017 -s $MONGO_SHELL --mongo-repo-path /home/alvin/mongo --writeCmd true --trialCount $TRIAL_COUNT --trialTime $DURATION --testFilter '\$SUITE\' $DYNO"
echo $CMD >> $DBLOGS/cmd.log
echo "" >> $DBLOGS/cmd.log
eval taskset -c 24-31 unbuffer $CMD 2>&1 | tee $DBLOGS/mp.log
killall -w -s 9 mongod
pushd .
cd $DBLOGS
tar zcf $TARFILES/$LBL.tgz *
popd done
done
done