Add virtual-threads-benchmark: re-run Spring Boot 4.1 / JDK 25 benchmarks, JEP 491 pinning fixed
Companion module for the rewritten post 'Virtual Threads on Spring Boot 4.1: The Benchmarks, Re-Run, and the Pinning Advice That Expired', retitled and re-benchmarked on Boot 4.1.1 / JDK 25.0.4.1 (the original post was written against Boot 3.4 / JDK 21). Covers: I/O-bound and CPU-bound throughput (platform vs virtual threads, including a JIT-warmup benchmarking bug this build caught and fixed), JEP 491 proof that synchronized no longer pins a virtual thread's carrier across a blocking call as of JDK 24 (obsoleting the old avoid-synchronized advice), proof that -Djdk.tracePinnedThreads=full is inert on JDK 25, and JEP 506's finalized ScopedValue API (JDK 25 GA, no --enable-preview, and a different shape than the old preview API). Kept as its own module rather than a new top-level repository, alongside the existing async/ module, which already has a stronger dual-JDK JEP 491 proof that this module's docs cross-link to instead of duplicating.
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
# Confirms -Djdk.tracePinnedThreads=full is inert on this JDK (JEP 491, GA in JDK 24).
|
||||
# Pre-JDK-24, this flag made a pinned virtual thread print a stack trace to stdout while
|
||||
# pinned. Runs PinningTraceCheckMain (which holds a monitor across Thread.sleep(200) on a
|
||||
# virtual thread) once without the flag and once with it, and diffs stdout. Output:
|
||||
# docs/output/03b-trace-pinned-threads-removed.txt. See docs/03-pinning-diagnosis.md.
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
mkdir -p docs/output
|
||||
OUT=docs/output/03b-trace-pinned-threads-removed.txt
|
||||
|
||||
echo "java -version:" > "$OUT"
|
||||
java -version 2>&1 | grep -v "^Picked up JAVA_TOOL_OPTIONS" >> "$OUT"
|
||||
echo "" >> "$OUT"
|
||||
|
||||
echo "-- without -Djdk.tracePinnedThreads=full --" >> "$OUT"
|
||||
java -cp target/classes com.ankurm.vthreads.PinningTraceCheckMain 2>&1 | grep -v "^Picked up JAVA_TOOL_OPTIONS" >> "$OUT"
|
||||
|
||||
echo "" >> "$OUT"
|
||||
echo "-- with -Djdk.tracePinnedThreads=full --" >> "$OUT"
|
||||
java -Djdk.tracePinnedThreads=full -cp target/classes com.ankurm.vthreads.PinningTraceCheckMain 2>&1 | grep -v "^Picked up JAVA_TOOL_OPTIONS" >> "$OUT"
|
||||
|
||||
echo "" >> "$OUT"
|
||||
if grep -q "Thread\[#" "$OUT" && grep -qi "monitors:" "$OUT"; then
|
||||
echo "RESULT: a pinned-thread stack trace WAS printed -- flag still functional on this JDK" >> "$OUT"
|
||||
else
|
||||
echo "RESULT: no pinned-thread stack trace was printed by either run -- the flag is inert on this JDK, consistent with JEP 491" >> "$OUT"
|
||||
fi
|
||||
|
||||
cat "$OUT"
|
||||
Reference in New Issue
Block a user