-
Notifications
You must be signed in to change notification settings - Fork 0
/
execute-jpetstore-without-access-control-effector.sh
executable file
·190 lines (138 loc) · 5.48 KB
/
execute-jpetstore-without-access-control-effector.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
#!/bin/bash
## Execute a distributed JPetStore with docker locally.
## Utilize one workload model to drive the JPetStore or
## allow interactive mode.
# parameter
# $1 = workload driver configuration (optional)
BASE_DIR=$(cd "$(dirname "$0")"; pwd)
if [ -f $BASE_DIR/config ] ; then
. $BASE_DIR/config
else
echo "Missing configuration"
exit 1
fi
. $BASE_DIR/common-functions.sh
#############################################
# common functions
# stopping docker container
function stopDocker() {
information "Stopping existing distributed jpetstore instances ..."
docker stop frontend
docker stop order
docker stop catalog
docker stop account
docker rm frontend
docker rm order
docker rm catalog
docker rm account
docker network rm jpetstore-net
information "done"
}
###################################
# check parameters
if [ "$1" == "" ] ; then
error "Cannot run experiment without workload."
exit 1
else
WORKLOAD_PATH="$1"
fi
###################################
# check setup
checkExecutable workload-runner $WORKLOAD_RUNNER
checkFile log-configuration $BASE_DIR/log4j.cfg
checkFile workload "$WORKLOAD_PATH"
information "Using workload ${WORKLOAD_PATH}"
export PROBE_DATA_DIR="${DATA_DIR}/probe/baseline"
###################################
# create configurations
if [ ! -d "${PROBE_DATA_DIR}" ] ; then
mkdir "${PROBE_DATA_DIR}"
fi
RESPONSE_TIME="${PROBE_DATA_DIR}/response-time"
if [ -d "${PROBE_DATA_DIR}" ] ; then
rm -rf "${PROBE_DATA_DIR}"
fi
mkdir -p "${RESPONSE_TIME}"
RESPONSE_TIME_PROPERTIES="$BASE_DIR/kieker-calc-response-time.properties"
cat << EOF > "${RESPONSE_TIME_PROPERTIES}"
kieker.monitoring.name=KIEKER
kieker.monitoring.debug=false
kieker.monitoring.enabled=true
kieker.monitoring.hostname=
kieker.monitoring.initialExperimentId=1
kieker.monitoring.metadata=true
kieker.monitoring.setLoggingTimestamp=true
kieker.monitoring.useShutdownHook=true
kieker.monitoring.jmx=false
####### TIMER #######
kieker.monitoring.timer=kieker.monitoring.timer.SystemNanoTimer
kieker.monitoring.timer.SystemMilliTimer.unit=0
kieker.monitoring.timer.SystemNanoTimer.unit=0
####### WRITER #######
kieker.monitoring.writer=kieker.monitoring.writer.filesystem.FileWriter
kieker.monitoring.core.controller.WriterController.RecordQueueFQN=org.jctools.queues.MpscArrayQueue
kieker.monitoring.core.controller.WriterController.RecordQueueSize=10000
kieker.monitoring.core.controller.WriterController.RecordQueueInsertBehavior=1
kieker.monitoring.writer.filesystem.FileWriter.customStoragePath=$RESPONSE_TIME/
kieker.monitoring.writer.filesystem.FileWriter.charsetName=UTF-8
kieker.monitoring.writer.filesystem.FileWriter.maxEntriesInFile=25000
kieker.monitoring.writer.filesystem.FileWriter.maxLogSize=-1
kieker.monitoring.writer.filesystem.FileWriter.maxLogFiles=-1
kieker.monitoring.writer.filesystem.FileWriter.mapFileHandler=kieker.monitoring.writer.filesystem.TextMapFileHandler
kieker.monitoring.writer.filesystem.TextMapFileHandler.flush=true
kieker.monitoring.writer.filesystem.TextMapFileHandler.compression=kieker.monitoring.writer.compression.NoneCompressionFilter
kieker.monitoring.writer.filesystem.FileWriter.logFilePoolHandler=kieker.monitoring.writer.filesystem.RotatingLogFilePoolHandler
kieker.monitoring.writer.filesystem.FileWriter.logStreamHandler=kieker.monitoring.writer.filesystem.TextLogStreamHandler
kieker.monitoring.writer.filesystem.FileWriter.flush=false
kieker.monitoring.writer.filesystem.BinaryFileWriter.bufferSize=8192
kieker.monitoring.writer.filesystem.BinaryFileWriter.compression=kieker.monitoring.writer.compression.NoneCompressionFilter
EOF
###################################
# check if no leftovers are running
# stop docker
stopDocker
###################################
# starting
# jpetstore
information "Start jpetstore"
docker network create --driver bridge jpetstore-net
docker run -e LOGGER=$LOGGER -e LOCATION=GERMANY -d --name account -p 5791:5791 --network=jpetstore-net jpetstore-account-service-without-effector
docker run -e LOGGER=$LOGGER -d --name order --network=jpetstore-net jpetstore-order-service
docker run -e LOGGER=$LOGGER -d --name catalog --network=jpetstore-net jpetstore-catalog-service
docker run -e LOGGER=$LOGGER -d --name frontend --network=jpetstore-net -p 8080:8080 jpetstore-frontend-service
ID=`docker ps | grep 'frontend' | awk '{ print $1 }'`
FRONTEND=`docker inspect $ID | grep '"IPAddress' | awk '{ print $2 }' | tail -1 | sed 's/^"\(.*\)",/\1/g'`
SERVICE_URL="http://$FRONTEND:8080/jpetstore-frontend"
information "Service URL $SERVICE_URL"
while ! curl -sSf $SERVICE_URL 2> /dev/null > /dev/null ; do
echo "wait for service coming up..."
sleep 1
done
ID=`docker ps | grep 'account' | awk '{ print $1 }'`
ACCOUNT=`docker inspect $ID | grep '"IPAddress' | awk '{ print $2 }' | tail -1 | sed 's/^"\(.*\)",/\1/g'`
# check workload
information "Running workload driver"
export SELENIUM_EXPERIMENT_WORKLOADS_OPTS="-Dlog4j.configuration=file:///$BASE_DIR/log4j-info.cfg -Dkieker.monitoring.configuration=$RESPONSE_TIME_PROPERTIES"
$WORKLOAD_RUNNER -c $WORKLOAD_PATH -u "$SERVICE_URL" &
export WORKLOAD_PID=$!
ITERATION=0
REDEPLOYS=10000
while [ $ITERATION -lt $REDEPLOYS ] ; do
ITERATION=`expr $ITERATION + 1`
B_NET=`expr $ITERATION % 255`
information "Loop $ITERATION -- B-net $B_NET"
# node 2/node 1 delay
sleep 1.2002665767
done
sleep 10
###################################
# shutdown
# shutdown workload
kill -TERM $WORKLOAD_PID
sleep 10
kill -9 $WORKLOAD_PID
# shutdown jpetstore
stopDocker
##
rm "${RESPONSE_TIME_PROPERTIES}"
# end