Add crac module: Spring Boot 4.2 started by CRaC checkpoint/restore vs JDK AOT cache vs native image
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
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
de2660e998
commit
c0062ea398
Executable
+25
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
# The Zulu 25 CRaC JVM ships more than one engine. Which one ran above, and does the CRIU one work in this sandbox?
|
||||
source "$(dirname "$0")/lib.sh"
|
||||
cd "$WORK"; J="$JDK_CRAC/bin/java"; : > "$OUT/06-engines.txt"
|
||||
say() { echo "$@" | tee -a "$OUT/06-engines.txt"; }
|
||||
say "files in the JDK's lib directory that belong to CRaC:"; ls "$JDK_CRAC/lib" | grep -i -E 'criu|crac|warp|engine' | sed 's/^/ /' | tee -a "$OUT/06-engines.txt"
|
||||
say; say "== the same flag on the stock Temurin 25 JDK"
|
||||
run_env "$JDK_PLAIN/bin/java" -XX:CRaCCheckpointTo="$WORK/cp-temurin" -version 2>&1 | head -3 | scrub | tee -a "$OUT/06-engines.txt"
|
||||
say; say "engine recorded in the default checkpoint (cp-refresh/engine): $(cat cp-refresh/engine 2>/dev/null)"
|
||||
say "process capabilities (CapEff): $(grep CapEff /proc/self/status | awk '{print $2}'), uid $(id -u)"
|
||||
for ENG in warp criuengine; do
|
||||
say; say "== -XX:CRaCEngine=$ENG, checkpoint at start-up then restore"
|
||||
rm -rf "cp-eng-$ENG"
|
||||
# CRIU is picky about the process it dumps: a regular file open as stdout must not change size before the restore ("has bad size"),
|
||||
# a stdin that is a socket fails the dump ("External socket is used"), and a JVM that is not its own session leader cannot be restored
|
||||
# ("Current gid ... intersects with pid ... in images"). So: new session (setsid), stdin /dev/null, stdout through a pipe (cat).
|
||||
setsid --wait bash -c "env -u JAVA_TOOL_OPTIONS -u _JAVA_OPTIONS '$J' -XX:CRaCEngine=$ENG -XX:CRaCCheckpointTo='$WORK/cp-eng-$ENG' -Dspring.context.checkpoint=onRefresh -jar '$APPJAR' --server.port=$PORT 2>&1 | cat > 'eng-$ENG-1.log'" < /dev/null
|
||||
say "checkpoint directory: $(ls cp-eng-$ENG 2>/dev/null | head -3 | tr "\n" " ")($(ls cp-eng-$ENG | wc -l) files); size: $(du -sm cp-eng-$ENG 2>/dev/null | cut -f1) MB"
|
||||
grep -E 'warp:|criu|CRIU|Error|error:|Checkpoint' "eng-$ENG-1.log" | grep -v 'always available' | scrub | head -8 | tee -a "$OUT/06-engines.txt"
|
||||
if [ -d "cp-eng-$ENG" ]; then
|
||||
setsid env -u JAVA_TOOL_OPTIONS -u _JAVA_OPTIONS "$J" -XX:CRaCEngine=$ENG -XX:CRaCRestoreFrom="$WORK/cp-eng-$ENG" > "eng-$ENG-2.log" 2>&1 < /dev/null &
|
||||
if wait_ready; then say "restored; GET /ping -> $(curl -s localhost:$PORT/ping); $(grep -E 'Restored CracDemo' eng-$ENG-2.log | scrub | sed -E 's/.*: //')"; else say "restore did not become ready"; grep -v '^$' "eng-$ENG-2.log" | scrub | head -6 | tee -a "$OUT/06-engines.txt"; fi
|
||||
stop_port
|
||||
fi
|
||||
done
|
||||
Reference in New Issue
Block a user