One service, seven start-up configurations measured over ten interleaved rounds on Temurin 25, Zulu 25 CRaC and Oracle GraalVM 25; the open-file checkpoint failure and its fix, stale environment values, secrets in the checkpoint, warp and CRIU engines, cold page cache. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b5uEyg58znuchZ8C8i
36 lines
2.4 KiB
Bash
Executable File
36 lines
2.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Creates the checkpoints and AOT caches the benchmark restores/uses, and records what it cost.
|
|
source "$(dirname "$0")/lib.sh"
|
|
cd "$WORK"; : > "$OUT/02-create.txt"
|
|
say() { echo "$@" | tee -a "$OUT/02-create.txt"; }
|
|
|
|
say "== CRaC checkpoint at start-up (-Dspring.context.checkpoint=onRefresh)"
|
|
rm -rf cp-refresh; t0=$(now_ms)
|
|
run_env "$JDK_CRAC/bin/java" -XX:CRaCCheckpointTo="$WORK/cp-refresh" -Dspring.context.checkpoint=onRefresh -jar "$APPJAR" --server.port=$PORT > refresh.log 2>&1 || true
|
|
t1=$(now_ms)
|
|
say "process exited after $((t1-t0)) ms; checkpoint dir: $(ls cp-refresh | tr '\n' ' ') size: $(du_mb cp-refresh) MB"
|
|
grep -E 'Starting CracDemo|Checkpoint|warp: Checkpoint' refresh.log | grep -v 'always available' | scrub | tee -a "$OUT/02-create.txt"
|
|
|
|
say; say "== CRaC checkpoint after warm-up (300 POST + 300 GET, then jcmd JDK.checkpoint)"
|
|
rm -rf cp-warm
|
|
setsid env -u JAVA_TOOL_OPTIONS -u _JAVA_OPTIONS "$JDK_CRAC/bin/java" -XX:CRaCCheckpointTo="$WORK/cp-warm" -jar "$APPJAR" --server.port=$PORT > warm.log 2>&1 < /dev/null &
|
|
wait_ready || { say "app did not start"; exit 1; }
|
|
PID=$(pgrep -f "CRaCCheckpointTo=$WORK/cp-warm" | head -1)
|
|
$TOOL traffic "$PORT" 300
|
|
t0=$(now_ms); run_env "$JDK_CRAC/bin/jcmd" "$PID" JDK.checkpoint > jcmd.log 2>&1 || true; t1=$(now_ms)
|
|
wait_exit "$PID"; t2=$(now_ms)
|
|
say "jcmd JDK.checkpoint returned after $((t1-t0)) ms; process gone after $((t2-t0)) ms; checkpoint size: $(du_mb cp-warm) MB"
|
|
grep -E 'Spring-managed|Checkpoint|checkpoint|warp: Checkpoint' warm.log | scrub | tee -a "$OUT/02-create.txt"
|
|
|
|
say; say "== JDK AOT cache (JEP 514), context-only training"
|
|
rm -f ctx.aot; t0=$(now_ms)
|
|
run_env "$JDK_PLAIN/bin/java" -XX:AOTCacheOutput="$WORK/ctx.aot" -Dspring.context.exit=onRefresh -jar "$APPJAR" --server.port=$PORT > aot-ctx.log 2>&1
|
|
say "training took $(( $(now_ms)-t0 )) ms; $(ls -l ctx.aot | awk '{printf "%.0f MB", $5/1048576}')"
|
|
|
|
say; say "== JDK AOT cache, training with the same 300-request warm-up"
|
|
rm -f traffic.aot
|
|
setsid env -u JAVA_TOOL_OPTIONS -u _JAVA_OPTIONS "$JDK_PLAIN/bin/java" -XX:AOTCacheOutput="$WORK/traffic.aot" -jar "$APPJAR" --server.port=$PORT > aot-traffic.log 2>&1 < /dev/null &
|
|
t0=$(now_ms); wait_ready; PID=$(pgrep -f "AOTCacheOutput=$WORK/traffic.aot" | head -1)
|
|
$TOOL traffic "$PORT" 300; kill -TERM "$PID"; wait_exit "$PID"
|
|
say "training took $(( $(now_ms)-t0 )) ms; $(ls -l traffic.aot | awk '{printf "%.0f MB", $5/1048576}')"
|