Add jfr-demo: JFR + Mission Control profiling of a live Spring Boot app
Custom OrderProcessed event, CPU/allocation/lock workloads, a diagnostic endpoint over the JVM's live FlightRecorder state, a JUnit test using the jdk.jfr.Recording API, and nine captured recordings (flagship, mid-flight snapshot, isolated vs concurrent threshold comparisons, and a real dump+stop duplication bug) with their docs/output/*.txt transcripts.
This commit is contained in:
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build and start the demo app in the foreground (or detached with -d).
|
||||
# Usage: scripts/run.sh [-d]
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
for p in $(ps -eo pid,cmd | grep '[j]fr-demo.jar' | awk '{print $1}'); do
|
||||
echo "killing previous instance: $p"
|
||||
kill -9 "$p"
|
||||
done
|
||||
|
||||
mvn -q -B -DskipTests package
|
||||
|
||||
if [[ "${1:-}" == "-d" ]]; then
|
||||
setsid nohup java -jar target/jfr-demo.jar > /tmp/jfr-demo.log 2>&1 < /dev/null &
|
||||
echo "started detached, pid $!"
|
||||
for i in $(seq 1 30); do
|
||||
code=$(curl -s -o /dev/null -w '%{http_code}' localhost:8080/api/jfr/recordings || true)
|
||||
[[ "$code" == "200" ]] && { echo "up after ${i}s"; exit 0; }
|
||||
sleep 1
|
||||
done
|
||||
echo "app did not come up in time, see /tmp/jfr-demo.log" >&2
|
||||
exit 1
|
||||
else
|
||||
exec java -jar target/jfr-demo.jar
|
||||
fi
|
||||
Reference in New Issue
Block a user