-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexecute-accounting-ac-effector-impact-driver.sh
More file actions
executable file
·231 lines (179 loc) · 7.73 KB
/
Copy pathexecute-accounting-ac-effector-impact-driver.sh
File metadata and controls
executable file
·231 lines (179 loc) · 7.73 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
#!/bin/bash
# Please note: This script must be started first
# Before execution make sure the service side does not contain a ac.wait
# file.
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
# number of repetitions of requests
REPETITIONS=100000
# how often to log the current number of repetitions
COUNT=1000
# IP address where the account service is running
# Please note: This must be the IP address the driver shall send its
# requests to. Do not use the internal docker IP address here as that
# address is only readchable from the host system
ACCOUNT_SERVICE="192.168.48.223"
# IP address where the control service is running
# Please note: This must be the IP address of the host computer of the
# account-driver
CONTROL_SERVICE="192.168.48.225"
if [ "$1" == "" ] ; then
RUN_TYPE="accounting-sans"
CONTAINER="jpetstore-account-service-sans-effector"
LIST_SIZE="NONE"
else
RUN_TYPE="accounting/$1"
CONTAINER="jpetstore-account-service"
LIST_SIZE="$1"
fi
#############################################
# common functions
# drive service
function driveService() {
information "Run accounting driver"
cat << EOF > $ACCOUNTING_KIEKER_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=$STORAGE_PATH/
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
export DRIVE_ACCOUNTING_OPTS="-Dlog4j.configuration=file:///${BASE_DIR}/log4j.cfg -Dkieker.monitoring.configuration=${ACCOUNTING_KIEKER_PROPERTIES}"
${DRIVE_ACCOUNTING} -u $1 -d 100 -c $COUNT -r $REPETITIONS
}
# run collector
function startCollector() {
information "Start collector"
cat << EOF > $COLLECTOR_PROPERTIES
# common
kieker.monitoring.name=0
kieker.monitoring.hostname=
kieker.monitoring.metadata=true
# TCP collector
iobserve.service.reader=org.iobserve.service.source.MultipleConnectionTcpCompositeStage
org.iobserve.service.source.MultipleConnectionTcpCompositeStage.port=9876
org.iobserve.service.source.MultipleConnectionTcpCompositeStage.capacity=81920
# dump stage
kieker.monitoring.writer=kieker.monitoring.writer.filesystem.FileWriter
kieker.monitoring.writer.filesystem.FileWriter.customStoragePath=${COLLECTOR_DATA_PATH}
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.filesystem.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=true
kieker.monitoring.writer.filesystem.FileWriter.bufferSize=81920
EOF
export COLLECTOR_OPTS="-Dlog4j.configuration=file:///${BASE_DIR}/log4j.cfg"
$COLLECTOR -c "${COLLECTOR_PROPERTIES}" &
COLLECTOR_PID=$!
information "done"
}
# stop collector
function stopCollector() {
information "Stopping collector"
kill -TERM ${COLLECTOR_PID}
rm $COLLECTOR_PROPERTIES
wait ${COLLECTOR_PID}
information "Experiment complete."
}
# configure effector
# $1 = list size
function configureEffector() {
information "Running effector configuration"
PREFIX="10.10"
B_BASE="1"
W_BASE=`expr $1 + 10`
BS_LOW=`expr $B_BASE % 256`
BS_HIGH=`expr $B_BASE / 256`
BE=`expr $B_BASE + $1`
BE_LOW=`expr $BE % 256`
BE_HIGH=`expr $BE / 256`
WS_LOW=`expr $W_BASE % 256`
WS_HIGH=`expr $W_BASE / 256`
WE=`expr $W_BASE + $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-debug.cfg"
$AC_CONFIGURATION -bs "$PREFIX.$BS_HIGH.$BS_LOW" -be "$PREFIX.$BE_HIGH.$BE_LOW" \
-h "${ACCOUNT_SERVICE}" -p 5791 -ws "$PREFIX.$WS_HIGH.$WS_LOW" -we "$PREFIX.$WE_HIGH.$WE_LOW" -w 172.17.0.1 "${CONTROL_SERVICE}"
information "done"
}
###################################
# check parameters
ACCOUNTING_KIEKER_PROPERTIES="$BASE_DIR/kieker-drive-accounting.properties"
COLLECTOR_PROPERTIES="$BASE_DIR/kieker-collector.properties"
export STORAGE_PATH="${DATA_DIR}/${RUN_TYPE}/responses"
export COLLECTOR_DATA_PATH="${DATA_DIR}/${RUN_TYPE}/collector"
checkExecutable access-control "$AC_CONFIGURATION"
checkExecutable collector "$COLLECTOR"
checkExecutable drive-accounting "$DRIVE_ACCOUNTING"
checkDirectory data-dir "${DATA_DIR}"
if [ -d "${STORAGE_PATH}" ] ; then
rm -rf "${STORAGE_PATH}"
fi
if [ -d "${COLLECTOR_DATA_PATH}" ] ; then
rm -rf "${COLLECTOR_DATA_PATH}"
fi
mkdir -p "${STORAGE_PATH}"
mkdir -p "${COLLECTOR_DATA_PATH}"
###################################
# check if no leftovers are running
###################################
# run experiment
startCollector
SERVICE_URL="http://${ACCOUNT_SERVICE}:8080/jpetstore-account"
information "Service URL $SERVICE_URL"
ssh "pi@${ACCOUNT_SERVICE}" "touch /home/pi/jss-privacy-experiment/ac.wait"
while ! curl -sSf $SERVICE_URL 2> /dev/null > /dev/null ; do
echo "wait for service coming up..."
sleep 1
done
if [ "${LIST_SIZE}" != "NONE" ] ; then
configureEffector "${LIST_SIZE}"
else
information "no effector"
fi
driveService "${SERVICE_URL}"
ssh "pi@${ACCOUNT_SERVICE}" "rm /home/pi/jss-privacy-experiment/ac.token"
###################################
# complete experiment
stopCollector
# end