Spring Boot 4.1.1 harness measuring first-response time versus initial heap size and a 20,000-request warmup. Shows -XX:+ZAdaptiveHeapSizing is not yet in any build. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WzVQ6zFh9cuLPj9RSbRH8U
33 lines
1.3 KiB
Bash
Executable File
33 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Usage: startup.sh <java-home> <label> <runs> [jvm args...]
|
|
# Starts the Spring Boot jar, polls /hello until HTTP 200, and prints wall-clock ms from
|
|
# process start to first response plus the committed heap one second later. One line per run,
|
|
# then a summary line (min / median / max).
|
|
set -u
|
|
JH=$1; LABEL=$2; RUNS=$3; shift 3
|
|
JAR="$(dirname "$0")/../target/jdk28-zgc-1.0.0.jar"
|
|
PORT=${PORT:-18080}
|
|
times=()
|
|
for r in $(seq 1 "$RUNS"); do
|
|
t0=$(date +%s%N)
|
|
"$JH/bin/java" "$@" -jar "$JAR" --server.port=$PORT --spring.main.banner-mode=off \
|
|
--logging.level.root=WARN > /dev/null 2>&1 &
|
|
PID=$!
|
|
while :; do
|
|
code=$(curl -s -o /dev/null -m 1 -w '%{http_code}' "localhost:$PORT/hello")
|
|
[ "$code" = 200 ] && break
|
|
kill -0 $PID 2>/dev/null || { echo "$LABEL run $r: JVM exited early"; break; }
|
|
sleep 0.02
|
|
done
|
|
t1=$(date +%s%N)
|
|
ms=$(( (t1 - t0) / 1000000 ))
|
|
sleep 1
|
|
committed=$(curl -s "localhost:$PORT/heap" | sed -n 's/.*"committedMiB":\([0-9]*\).*/\1/p')
|
|
echo "$LABEL run $r: first-response ${ms} ms, committed heap ${committed} MiB"
|
|
times+=("$ms")
|
|
kill $PID 2>/dev/null; wait $PID 2>/dev/null
|
|
done
|
|
sorted=($(printf '%s\n' "${times[@]}" | sort -n))
|
|
n=${#sorted[@]}
|
|
echo "$LABEL SUMMARY: min ${sorted[0]} ms, median ${sorted[$((n/2))]} ms, max ${sorted[$((n-1))]} ms (n=$n)"
|