-
Notifications
You must be signed in to change notification settings - Fork 1
/
run_online_monitoring.sh
executable file
·90 lines (75 loc) · 2.82 KB
/
run_online_monitoring.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
#!/bin/bash
##
## Requires that:
## (i) everything is installed,
## (ii) kafka unknown JVM parameters are deleted, and
## (iii) RMI is running
##
## Change those if you want to run the test with different load
## and acceleration, and for a longer period of time
LOAD=5000
ACCEL=0
TEST_TIME=600
helpFunction()
{
echo ""
echo "Usage: $0 [-l LOAD] [-t DURATION]"
echo -e "\t-l Load: Input events per second. Default: 5000"
echo -e "\t-t Duration: Experiment duration in seconds. Default: 600"
exit 1 # Exit script after printing help
}
while getopts "l:t:a:" opt
do
case "$opt" in
l ) LOAD="$OPTARG" ;;
t ) TEST_TIME="$OPTARG" ;;
a ) ACCEL="$OPTARG" ;;
? ) helpFunction ;; # Print helpFunction in case parameter is non-existent
esac
done
## The directory that will contain the results
RESULTS_PARENT_DIR="data/online-monitoring/"
RESULTS_DIR_NAME="server_load_${LOAD}_accel_${ACCEL}_time_${TEST_TIME}_test"
RESULTS_DIR="${RESULTS_PARENT_DIR}/${RESULTS_DIR_NAME}"
echo "Starting RMI registry"
rmiregistry -J-Djava.rmi.server.codebase=file:${HOME}/diffstream/target/classes/ &
sleep 1
cd streaming-benchmarks/
## A word of warning
echo "Please don't interrupt this script mid-execution or all hell could break loose :'("
echo "Stopping anything that could be running... be patient, this could take a couple minutes"
./flink-bench.sh STOP_ALL > /dev/null 2>&1
## Run the test
STDOUT_LOG=online-monitoring-stdout.log
STDERR_LOG=online-monitoring-stderr.log
## TODO: Figure out a good load and test time
echo "Running the test with load: ${LOAD} for duration: ${TEST_TIME} seconds."
echo "|-- stdout can be checked out here: streaming-benchmarks/${STDOUT_LOG}"
echo "|-- and stderr here: streaming-benchmarks/${STDERR_LOG}"
LOAD=${LOAD} TEST_TIME=${TEST_TIME} ACCEL=${ACCEL} ./flink-bench.sh FLINK_TEST 1> ${STDOUT_LOG} 2> ${STDERR_LOG}
## When this ends there is an exception but that is fine.
## TODO: Figure out if this could affect anything.
## Stop everything
echo "Stopping everything... be patient, this could take a couple minutes"
./flink-bench.sh STOP_ALL > /dev/null 2>&1
## Make a directory to store the results
echo "Storing the results in ${RESULTS_DIR}"
mkdir -p "../${RESULTS_DIR}"
cp memory-log.txt "../${RESULTS_DIR}/"
cp unmatched-items.txt "../${RESULTS_DIR}/"
mv durations-matcher-id-1.bin "../${RESULTS_DIR}/"
## Plot the results
#echo "Producing plots..."
#cd "../${RESULTS_PARENT_DIR}"
#python3 collect_and_plot.py "${RESULTS_DIR_NAME}"
#cd ../../
#
#echo "Plots and results are available in: ${RESULTS_DIR}"
#echo "File: ${RESULTS_DIR}/unmatched_histogram.pdf contains a histogram of the unmatched items."
#echo "File: ${RESULTS_DIR}/used_memory_in_time.pdf contains the used memory in time."
cd ..
PID="$(pidof rmiregistry)"
if [[ "${PID}" -ne "" ]]; then
echo "Stopping RMI registry"
kill "${PID}"
fi