-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexecute-jpetstore-ac-effector-impact.sh
More file actions
executable file
·276 lines (211 loc) · 8.93 KB
/
Copy pathexecute-jpetstore-ac-effector-impact.sh
File metadata and controls
executable file
·276 lines (211 loc) · 8.93 KB
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
#!/bin/bash
# Execute a distributed JPetStore with docker locally.
# Utilize one workload model to drive the JPetStore.
# parameter
# $1 = workload driver configuration
# $2 = size of the black and whitelist
# $3 = experiment identifier to separate different runs
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"
}
# $1 = list size
# $2 = blacklist start
# $3 = whitelist start
# $4 = prefix AAA.BBB
function triggerNewLists() {
BS_LOW=`expr $2 % 256`
BS_HIGH=`expr $2 / 256`
BE=`expr $2 + $1`
BE_LOW=`expr $BE % 256`
BE_HIGH=`expr $BE / 256`
WS_LOW=`expr $3 % 256`
WS_HIGH=`expr $3 / 256`
WE=`expr $3 + $1`
WE_LOW=`expr $WE % 256`
WE_HIGH=`expr $WE / 256`
# information "blacklist $BS_HIGH.$BS_LOW - $BE_HIGH.$BE_LOW whitelist $WS_HIGH.$WS_LOW - $WE_HIGH.$WE_LOW"
export RUNTIME_RECONFIGURE_MONITORING_CONTROLLER_OPTS="-Dlog4j.configuration=file:///$BASE_DIR/log4j.cfg -Dkieker.monitoring.configuration=$CONTROL_TIME_PROPERTIES"
$AC_CONFIGURATION -bs "$4.$BS_HIGH.$BS_LOW" -be "$4.$BE_HIGH.$BE_LOW" \
-h $ACCOUNT -p 5791 -ws "$4.$WS_HIGH.$WS_LOW" -we "$4.$WE_HIGH.$WE_LOW" -w $FRONTEND
}
###################################
# check parameters
if [ "$1" == "" ] ; then
error "Cannot run experiment without workload."
exit 1
else
WORKLOAD_PATH="$1"
fi
if [ "$2" == "" ] ; then
error "Need a number of nodes for the black- and whitelist."
exit 1
else
LIST_SIZE="$2"
fi
if [ "$3" == "" ] ; then
error "Requires experiment number to distinguish repetitions."
exit 1
else
EXPERIMENT="$3"
fi
###################################
# check setup
checkExecutable workload-runner $WORKLOAD_RUNNER
checkExecutable access-control $AC_CONFIGURATION
checkFile log-configuration $BASE_DIR/log4j.cfg
checkFile workload "$WORKLOAD_PATH"
information "Using workload ${WORKLOAD_PATH}"
export PROBE_DATA_DIR="${DATA_DIR}/probe/exp-${EXPERIMENT}"
###################################
# create configurations
if [ ! -d "${PROBE_DATA_DIR}" ] ; then
mkdir "${PROBE_DATA_DIR}"
fi
RESPONSE_TIME="${PROBE_DATA_DIR}/${LIST_SIZE}/response-time"
CONTROL_TIME="${PROBE_DATA_DIR}/${LIST_SIZE}/control-time"
if [ -d "${PROBE_DATA_DIR}/${LIST_SIZE}" ] ; then
rm -rf "${PROBE_DATA_DIR}/${LIST_SIZE}/"
fi
mkdir -p "${RESPONSE_TIME}"
mkdir -p "${CONTROL_TIME}"
RESPONSE_TIME_PROPERTIES="$BASE_DIR/kieker-calc-response-time.properties"
CONTROL_TIME_PROPERTIES="$BASE_DIR/kieker-probe-control-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
cat << EOF > "${CONTROL_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=$CONTROL_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
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'`
# send configuration
WS=`expr 10 + $LIST_SIZE`
triggerNewLists $LIST_SIZE 2 $WS "10.10"
# 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"
# send configuration
WS=`expr 10 + $LIST_SIZE`
triggerNewLists $LIST_SIZE 2 $WS "10.$B_NET"
done
sleep 10
###################################
# shutdown
# shutdown workload
kill -TERM $WORKLOAD_PID
sleep 10
kill -9 $WORKLOAD_PID
# shutdown jpetstore
stopDocker
rm "${CONTROL_TIME_PROPERTIES}" "${RESPONSE_TIME_PROPERTIES}"
# end