-
Notifications
You must be signed in to change notification settings - Fork 333
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·77 lines (61 loc) · 1.72 KB
/
run.sh
File metadata and controls
executable file
·77 lines (61 loc) · 1.72 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
#!/usr/bin/env bash
set -e
function message() {
echo "$(date +"%T"): $1"
}
function healthcheck() {
local url=$1
while true; do
if [[ $(curl -fso /dev/null -w "%{http_code}" "${url}") = 200 ]]; then
break
fi
done
}
type=$1
if [ -n "$CI_JOB_TOKEN" ]; then
# Inside BP, so we can assume 24 CPU cores on the second socket available and set CPU affinity
export CPU_AFFINITY_K6="taskset -c 24-27 "
else
export CPU_AFFINITY_K6=""
fi
source "${UTILS_DIR}/update-java-version.sh" 17
for app in *; do
if [[ ! -d "${app}" ]]; then
continue
fi
message "${type} benchmark: ${app} started"
export OUTPUT_DIR="${REPORTS_DIR}/${type}/${app}"
mkdir -p ${OUTPUT_DIR}
export LOGS_DIR="${ARTIFACTS_DIR}/${type}/${app}"
mkdir -p ${LOGS_DIR}
# Using profiler variants for healthcheck as they are the slowest
if [ "${app}" == "petclinic" ]; then
HEALTHCHECK_URL=http://localhost:8082
REPETITIONS_COUNT=5
elif [ "${app}" == "insecure-bank" ]; then
HEALTHCHECK_URL=http://localhost:8082/login
REPETITIONS_COUNT=2
else
echo "Unknown app ${app}"
exit 1
fi
for i in $(seq 1 $REPETITIONS_COUNT); do
bash -c "${UTILS_DIR}/../${type}/${app}/start-servers.sh" &
echo "Waiting for serves to start..."
if [ "${app}" == "petclinic" ]; then
for port in $(seq 8080 8085); do
healthcheck http://localhost:$port
done
elif [ "${app}" == "insecure-bank" ]; then
for port in $(seq 8080 8085); do
healthcheck http://localhost:$port/login
done
fi
echo "Servers are up!"
(
cd ${app} &&
bash -c "${CPU_AFFINITY_K6}${UTILS_DIR}/run-k6-load-test.sh 'pkill java'"
)
done
message "${type} benchmark: ${app} finished"
done