Skip to content

Commit 140dd23

Browse files
committed
Attempt to parallelize load benchmarks
1 parent 58a568e commit 140dd23

File tree

3 files changed

+36
-27
lines changed

3 files changed

+36
-27
lines changed

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:8080',
6+
"APP_URL": 'http://localhost:8086',
77
},
88
"tracing": {
9-
"APP_URL": 'http://localhost:8081',
9+
"APP_URL": 'http://localhost:8087',
1010
},
1111
"profiling": {
12-
"APP_URL": 'http://localhost:8082',
12+
"APP_URL": 'http://localhost:8088',
1313
},
1414
"iast": {
15-
"APP_URL": 'http://localhost:8083',
15+
"APP_URL": 'http://localhost:8089',
1616
},
1717
"iast_GLOBAL": {
18-
"APP_URL": 'http://localhost:8084',
18+
"APP_URL": 'http://localhost:8090',
1919
},
2020
"iast_FULL": {
21-
"APP_URL": 'http://localhost:8085',
21+
"APP_URL": 'http://localhost:8091',
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=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 " &
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 " &
2727

2828
wait

benchmark/load/run.sh

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

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

30-
for app in *; do
31-
if [[ ! -d "${app}" ]]; then
32-
continue
33-
fi
34-
30+
run_app_benchmark() {
31+
local app=$1
32+
3533
message "${type} benchmark: ${app} started"
3634

3735
export OUTPUT_DIR="${REPORTS_DIR}/${type}/${app}"
@@ -44,9 +42,15 @@ for app in *; do
4442
if [ "${app}" == "petclinic" ]; then
4543
HEALTHCHECK_URL=http://localhost:8082
4644
REPETITIONS_COUNT=5
45+
PORT_START=8080
46+
PORT_END=8085
47+
HEALTHCHECK_PATH=""
4748
elif [ "${app}" == "insecure-bank" ]; then
48-
HEALTHCHECK_URL=http://localhost:8082/login
49+
HEALTHCHECK_URL=http://localhost:8088/login
4950
REPETITIONS_COUNT=5
51+
PORT_START=8086
52+
PORT_END=8091
53+
HEALTHCHECK_PATH="/login"
5054
else
5155
echo "Unknown app ${app}"
5256
exit 1
@@ -56,15 +60,9 @@ for app in *; do
5660
bash -c "${UTILS_DIR}/../${type}/${app}/start-servers.sh" &
5761

5862
echo "Waiting for serves to start..."
59-
if [ "${app}" == "petclinic" ]; then
60-
for port in $(seq 8080 8085); do
61-
healthcheck http://localhost:$port
62-
done
63-
elif [ "${app}" == "insecure-bank" ]; then
64-
for port in $(seq 8080 8085); do
65-
healthcheck http://localhost:$port/login
66-
done
67-
fi
63+
for port in $(seq $PORT_START $PORT_END); do
64+
healthcheck http://localhost:$port$HEALTHCHECK_PATH
65+
done
6866
echo "Servers are up!"
6967

7068
(
@@ -74,4 +72,15 @@ for app in *; do
7472
done
7573

7674
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}" &
7783
done
84+
85+
# Wait for all background jobs to complete
86+
wait

0 commit comments

Comments
 (0)