Skip to content

Commit a9a53c6

Browse files
committed
Parallelize into separate jobs
1 parent 59bfbda commit a9a53c6

File tree

4 files changed

+48
-39
lines changed

4 files changed

+48
-39
lines changed

.gitlab/benchmarks.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,20 @@ benchmarks-startup:
3535
- ./steps/run-benchmarks.sh startup
3636
- ./steps/analyze-results.sh startup
3737

38-
benchmarks-load:
38+
benchmarks-load-petclinic:
3939
extends: .benchmarks
4040
script:
4141
- !reference [ .benchmarks, script ]
4242
- ./steps/capture-hardware-software-info.sh
43-
- ./steps/run-benchmarks.sh load
43+
- ./steps/run-benchmarks.sh load petclinic
44+
- ./steps/analyze-results.sh load
45+
46+
benchmarks-load-insecure-bank:
47+
extends: .benchmarks
48+
script:
49+
- !reference [ .benchmarks, script ]
50+
- ./steps/capture-hardware-software-info.sh
51+
- ./steps/run-benchmarks.sh load insecure-bank
4452
- ./steps/analyze-results.sh load
4553

4654
benchmarks-dacapo:
@@ -61,7 +69,9 @@ benchmarks-post-results:
6169
needs:
6270
- job: benchmarks-startup
6371
artifacts: true
64-
- job: benchmarks-load
72+
- job: benchmarks-load-petclinic
73+
artifacts: true
74+
- job: benchmarks-load-insecure-bank
6575
artifacts: true
6676
- job: benchmarks-dacapo
6777
artifacts: true

benchmark/load/insecure-bank/k6.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@ import {checkResponse, isOk, isRedirect} from "../../utils/k6.js";
33

44
const variants = {
55
"no_agent": {
6-
"APP_URL": 'http://localhost:8086',
6+
"APP_URL": 'http://localhost:8080',
77
},
88
"tracing": {
9-
"APP_URL": 'http://localhost:8087',
9+
"APP_URL": 'http://localhost:8081',
1010
},
1111
"profiling": {
12-
"APP_URL": 'http://localhost:8088',
12+
"APP_URL": 'http://localhost:8082',
1313
},
1414
"iast": {
15-
"APP_URL": 'http://localhost:8089',
15+
"APP_URL": 'http://localhost:8083',
1616
},
1717
"iast_GLOBAL": {
18-
"APP_URL": 'http://localhost:8090',
18+
"APP_URL": 'http://localhost:8084',
1919
},
2020
"iast_FULL": {
21-
"APP_URL": 'http://localhost:8091',
21+
"APP_URL": 'http://localhost:8085',
2222
},
2323
}
2424

benchmark/load/insecure-bank/start-servers.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ start_server() {
1818
echo "${CPU_AFFINITY_APP}java ${JAVA_OPTS} -Xms3G -Xmx3G -jar ${INSECURE_BANK} &> ${LOGS_DIR}/${VARIANT}/insecure-bank.log [PID=$PID]"
1919
}
2020

21-
start_server "no_agent" "-Dserver.port=8086" "taskset -c 48 " &
22-
start_server "tracing" "-javaagent:${TRACER} -Dserver.port=8087" "taskset -c 49 " &
23-
start_server "profiling" "-javaagent:${TRACER} -Ddd.profiling.enabled=true -Dserver.port=8088" "taskset -c 50 " &
24-
start_server "iast" "-javaagent:${TRACER} -Ddd.iast.enabled=true -Dserver.port=8089" "taskset -c 51 " &
25-
start_server "iast_GLOBAL" "-javaagent:${TRACER} -Ddd.iast.enabled=true -Ddd.iast.context.mode=GLOBAL -Dserver.port=8090" "taskset -c 52 " &
26-
start_server "iast_FULL" "-javaagent:${TRACER} -Ddd.iast.enabled=true -Ddd.iast.detection.mode=FULL -Dserver.port=8091" "taskset -c 53 " &
21+
start_server "no_agent" "-Dserver.port=8080" "taskset -c 47 " &
22+
start_server "tracing" "-javaagent:${TRACER} -Dserver.port=8081" "taskset -c 46 " &
23+
start_server "profiling" "-javaagent:${TRACER} -Ddd.profiling.enabled=true -Dserver.port=8082" "taskset -c 45 " &
24+
start_server "iast" "-javaagent:${TRACER} -Ddd.iast.enabled=true -Dserver.port=8083" "taskset -c 44 " &
25+
start_server "iast_GLOBAL" "-javaagent:${TRACER} -Ddd.iast.enabled=true -Ddd.iast.context.mode=GLOBAL -Dserver.port=8084" "taskset -c 43 " &
26+
start_server "iast_FULL" "-javaagent:${TRACER} -Ddd.iast.enabled=true -Ddd.iast.detection.mode=FULL -Dserver.port=8085" "taskset -c 42 " &
2727

2828
wait

benchmark/load/run.sh

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,19 @@ fi
2727

2828
source "${UTILS_DIR}/update-java-version.sh" 17
2929

30-
run_app_benchmark() {
31-
local app=$1
32-
30+
# Optional second argument to run a specific app for load benchmarks (i.e. "petclinic" or "insecure-bank")
31+
app_filter=${2:-""}
32+
33+
for app in *; do
34+
if [[ ! -d "${app}" ]]; then
35+
continue
36+
fi
37+
38+
# Skip if app filter is specified and doesn't match
39+
if [[ -n "${app_filter}" ]] && [[ "${app}" != "${app_filter}" ]]; then
40+
continue
41+
fi
42+
3343
message "${type} benchmark: ${app} started"
3444

3545
export OUTPUT_DIR="${REPORTS_DIR}/${type}/${app}"
@@ -42,15 +52,9 @@ run_app_benchmark() {
4252
if [ "${app}" == "petclinic" ]; then
4353
HEALTHCHECK_URL=http://localhost:8082
4454
REPETITIONS_COUNT=5
45-
PORT_START=8080
46-
PORT_END=8085
47-
HEALTHCHECK_PATH=""
4855
elif [ "${app}" == "insecure-bank" ]; then
49-
HEALTHCHECK_URL=http://localhost:8088/login
56+
HEALTHCHECK_URL=http://localhost:8082/login
5057
REPETITIONS_COUNT=5
51-
PORT_START=8086
52-
PORT_END=8091
53-
HEALTHCHECK_PATH="/login"
5458
else
5559
echo "Unknown app ${app}"
5660
exit 1
@@ -60,9 +64,15 @@ run_app_benchmark() {
6064
bash -c "${UTILS_DIR}/../${type}/${app}/start-servers.sh" &
6165

6266
echo "Waiting for serves to start..."
63-
for port in $(seq $PORT_START $PORT_END); do
64-
healthcheck http://localhost:$port$HEALTHCHECK_PATH
65-
done
67+
if [ "${app}" == "petclinic" ]; then
68+
for port in $(seq 8080 8085); do
69+
healthcheck http://localhost:$port
70+
done
71+
elif [ "${app}" == "insecure-bank" ]; then
72+
for port in $(seq 8080 8085); do
73+
healthcheck http://localhost:$port/login
74+
done
75+
fi
6676
echo "Servers are up!"
6777

6878
(
@@ -72,15 +82,4 @@ run_app_benchmark() {
7282
done
7383

7484
message "${type} benchmark: ${app} finished"
75-
}
76-
77-
# Run petclinic and insecure-bank benchmarks in parallel to reduce total runtime
78-
for app in *; do
79-
if [[ ! -d "${app}" ]]; then
80-
continue
81-
fi
82-
run_app_benchmark "${app}" &
8385
done
84-
85-
# Wait for all background jobs to complete
86-
wait

0 commit comments

Comments
 (0)