-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathone-click.sh
executable file
·350 lines (322 loc) · 7.59 KB
/
one-click.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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
repos="depfast" # repos name, default
workdir="~/code" # we default put our repos under the root
s1=$( cat ./ips/ip_s1 )
s2=$( cat ./ips/ip_s2 )
s3=$( cat ./ips/ip_s3 )
s4=$( cat ./ips/ip_s4 )
s5=$( cat ./ips/ip_s5 )
c1=$( cat ./ips/ip_c1 )
is_rw=$( cat ./ips/is_rw )
TPS="tps: "
servers=(
$s1
$s2
$s3
$s4
$s5
)
ONLY_CMD=0
SLOWDOWN_DUR=120
SLOWDOWN_DUR_EXP=160
TUPT_DUR=60
TUPT_DUR_EXP=100
if [ $is_rw -eq 1 ]
then # for rw
echo "using rw..."
SLOW_CONCURRENT_RAFT=340
SLOW_CONCURRENT_COPILOT=40
else
echo "using tpca"
SLOW_CONCURRENT_RAFT=200
SLOW_CONCURRENT_COPILOT=12
fi
# trials, by default: 1
# please keep same as the variable in ./data_processing/processing.py
FIGURE5a_TARIALS=3
FIGURE5b_TARIALS=3
FIGURE6a_TARIALS=3
FIGURE6b_TARIALS=3
ulimit -n 10000
LOG_FILE="./log.txt"
echo "" > $LOG_FILE
setup () {
if [ $ONLY_CMD -eq 0 ]
then
echo "TRY to kill"
bash ./batch_op.sh kill
#bash ./batch_op.sh init
sleep 5
fi
}
build_scp() {
python3 waf configure -J build
bash ./batch_op.sh scp
}
timeout_process() {
cmd=$1
waitTime=$2
rerun=$3
myPid=$! echo "[$(date)]START timeout_process $cmd, rerun: $rerun\n" >> $LOG_FILE
sleep $waitTime
if kill -0 "$myPid"; then
# still alive, kill it then re-run it
kill -9 "$myPid"
bash ./batch_op.sh kill
if [ $rerun -eq 1 ]
then
setup
eval $cmd
timeout_process "$cmd" $waitTime 0
fi
else
echo "job is done"
fi
}
# figure5a:
# 1. fail-slow on followers with fpga_raft
# 2. no slowdown
# 3. replicas: 3, 5
# 4. fix # of client and then vary # of concurrent
experiment5a() {
suffix=_$1
mkdir -p ./figure5a$suffix
rm -rf ./figure5a$suffix/*
rm -rf ./results
# 3 replicas
if [ $is_rw -eq 1 ]
then # for rw
conc=( 20 40 60 80 100 130 160 190 200 220 260 300 340 380 420 460 500 540 580 )
else
conc=( 20 40 60 80 100 130 160 190 200 220 260 300 340 380 420 )
fi
for i in "${conc[@]}"
do
mkdir results
cmd="./start-exp.sh testname $TUPT_DUR 0 3 follower 1 $i fpga_raft nonlocal &"
if [ $ONLY_CMD -eq 1 ]
then
echo $cmd
else
setup
eval $cmd
timeout_process "$cmd" $TUPT_DUR_EXP 1
# if error detected, re-run it
if ! ag $TPS ./log; then
echo "[$(date)]not TPS\n " >> $LOG_FILE
setup
eval $cmd
timeout_process "$cmd" $TUPT_DUR_EXP 0
fi
ag $TPS ./log >> $LOG_FILE
fi
mv results ./figure5a$suffix/results_3_$i
cp -r log ./figure5a$suffix/log_3_$i
done
# 5 replicas
for i in "${conc[@]}"
do
mkdir results
cmd="./start-exp.sh testname $TUPT_DUR 0 5 follower 1 $i fpga_raft nonlocal &"
if [ $ONLY_CMD -eq 1 ]
then
echo $cmd
else
setup
eval $cmd
timeout_process "$cmd" $TUPT_DUR_EXP 1
# if error detected, re-run it
if ! ag $TPS ./log; then
echo "[$(date)]not TPS\n " >> $LOG_FILE
setup
eval $cmd
timeout_process "$cmd" $TUPT_DUR_EXP 0
fi
ag $TPS ./log >> $LOG_FILE
fi
mv results ./figure5a$suffix/results_5_$i
cp -r log ./figure5a$suffix/log_5_$i
done
}
# figure5b:
# 1. fail-slow on followers with fpga_raft
# 2. with 6 slowdown types
# 3. replicas: 3, 5
experiment5b() {
suffix=_$1
mkdir -p ./figure5b$suffix
rm -rf ./figure5b$suffix/*
rm -rf ./results
# 3 replicas
exp=( 1 2 3 4 5 6 )
for i in "${exp[@]}"
do
mkdir results
cmd="./start-exp.sh testname $SLOWDOWN_DUR $i 3 follower 1 $SLOW_CONCURRENT_RAFT fpga_raft nonlocal &"
if [ $ONLY_CMD -eq 1 ]
then
echo $cmd
else
setup
eval $cmd
timeout_process "$cmd" $SLOWDOWN_DUR_EXP 1
# if error detected, re-run it
if ! ag $TPS ./log; then
echo "[$(date)]not TPS\n " >> $LOG_FILE
setup
eval $cmd
timeout_process "$cmd" $SLOWDOWN_DUR_EXP 0
fi
ag $TPS ./log >> $LOG_FILE
fi
mv results ./figure5b$suffix/results_3_$i
cp -r log ./figure5b$suffix/log_3_$i
done
# 5 replicas
for i in "${exp[@]}"
do
mkdir results
cmd="./start-exp.sh testname $SLOWDOWN_DUR $i 5 follower 1 $SLOW_CONCURRENT_RAFT fpga_raft nonlocal &"
if [ $ONLY_CMD -eq 1 ]
then
echo $cmd
else
setup
eval $cmd
timeout_process "$cmd" $SLOWDOWN_DUR_EXP 1
# if error detected, re-run it
if ! ag $TPS ./log; then
echo "[$(date)]not TPS\n " >> $LOG_FILE
setup
eval $cmd
timeout_process "$cmd" $SLOWDOWN_DUR_EXP 0
fi
ag $TPS ./log >> $LOG_FILE
fi
mv results ./figure5b$suffix/results_5_$i
cp -r log ./figure5b$suffix/log_5_$i
done
}
# figure6a:
# 1. 3 replica setting on copilot
# 2. no slowdown
# 3. fix # of client and then vary # of concurrent
experiment6a() {
suffix=_$1
mkdir -p ./figure6a$suffix
rm -rf ./figure6a$suffix/*
rm -rf ./results
if [ $is_rw -eq 1 ]
then
conc=( 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ) # for rw
else
conc=( 1 2 4 6 8 10 12 14 16 18 20 )
fi
for i in "${conc[@]}"
do
mkdir results
cmd="./start-exp.sh testname $TUPT_DUR 0 3 follower 10 $i copilot nonlocal &"
if [ $ONLY_CMD -eq 1 ]
then
echo $cmd
else
setup
eval $cmd
timeout_process "$cmd" $TUPT_DUR_EXP 1
# if error detected, re-run it
if ! ag $TPS ./log; then
echo "[$(date)]not TPS\n " >> $LOG_FILE
setup
eval $cmd
timeout_process "$cmd" $TUPT_DUR_EXP 0
fi
ag $TPS ./log >> $LOG_FILE
fi
mv results ./figure6a$suffix/results_$i
cp -r log ./figure6a$suffix/log_$i
done
}
# figure6b:
# 1. 3-replica setting on copilot
# 2. slowdown type: 1, 2, 5, 6
# 3. on follower and leader
experiment6b() {
suffix=_$1
mkdir -p ./figure6b$suffix
rm -rf ./figure6b$suffix/*
rm -rf ./results
exp=( 1 2 5 6 )
# on the leader
for i in "${exp[@]}"
do
mkdir results
cmd="./start-exp.sh testname $SLOWDOWN_DUR $i 3 leader 10 4 copilot nonlocal &"
if [ $ONLY_CMD -eq 1 ]
then
echo $cmd
else
setup
eval $cmd
timeout_process "$cmd" $SLOWDOWN_DUR_EXP 1
# if error detected, re-run it
if ! ag $TPS ./log; then
echo "[$(date)]not TPS\n " >> $LOG_FILE
setup
eval $cmd
timeout_process "$cmd" $SLOWDOWN_DUR_EXP 0
fi
ag $TPS ./log >> $LOG_FILE
fi
mv results ./figure6b$suffix/results_leader_$i
cp -r log ./figure6b$suffix/log_leader_$i
done
# on the follower
for i in "${exp[@]}"
do
mkdir results
cmd="./start-exp.sh testname $SLOWDOWN_DUR $i 3 follower 10 4 copilot nonlocal &"
if [ $ONLY_CMD -eq 1 ]
then
echo $cmd
else
setup
eval $cmd
timeout_process "$cmd" $SLOWDOWN_DUR_EXP 1
# if error detected, re-run it
if ! ag $TPS ./log; then
echo "[$(date)]not TPS\n " >> $LOG_FILE
setup
eval $cmd
timeout_process "$cmd" $SLOWDOWN_DUR_EXP 0
fi
ag $TPS ./log >> $LOG_FILE
fi
mv results ./figure6b$suffix/results_follower_$i
cp -r log ./figure6b$suffix/log_follower_$i
done
}
setup
if [ $ONLY_CMD -eq 0 ]
then
build_scp
fi
for (( c=1; c<=$FIGURE5a_TARIALS; c++ )); do
experiment5a $c
echo -e "experiment-5a\n"
done
for (( c=1; c<=$FIGURE5b_TARIALS; c++ )); do
experiment5b $c
echo -e "experiment-5b\n"
done
for (( c=1; c<=$FIGURE6a_TARIALS; c++ )); do
experiment6a $c
echo -e "experiment-6a\n"
done
for (( c=1; c<=$FIGURE6b_TARIALS; c++ )); do
experiment6b $c
echo -e "experiment-6b\n"
done
# draw figures
if [ $ONLY_CMD -eq 0 ]
then
bash draw_figure.sh
fi