-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsingle.sh
executable file
·57 lines (48 loc) · 946 Bytes
/
single.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
#!/usr/bin/env bash
#
# Usage
#
# $ SCENARIO=scenario ./single.sh microservice stringcheck [database]
#
if [ -z ${SCENARIO+x} ]; then
echo ERROR: envar SCENARIO must be set to rbinder or instrumented
exit 1
fi
# MicroService.
MS=$1
# String Check.
SC=$2
# Database Service
DS=$3
# Compose File.
export CF=./docker-compose.${SCENARIO}.yml
# Log File.
LF="${SCENARIO}-$1-start-time.log"
# Sample Size.
SS=30
mkdir -p logs
#
# Start db service.
#
if [ -n "$DS" ]; then
docker-compose -f $CF up -d $DS
while :; do
docker-compose -f $CF logs $DS | grep "waiting for connections" && break
sleep 1
done
fi
#
# Measure time to start.
#
while [ $SS -gt 0 ]; do
let SS=SS-1
/usr/bin/time -a -o ./logs/$LF -f "%e" ./start-app.sh $MS $SC
if [ $SS -gt 0 ]; then
docker-compose -f $CF up -d --scale $MS=0 $MS
sleep $(Rscript ./generate-random-number.r | awk {'print $2'})
fi
done
#
# Teardown.
#
./stopall.sh $CF