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
+39
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env bash
|
||||
# Generates the same real load used to produce docs/output/*.txt against a
|
||||
# running instance of the app (localhost:8080 by default).
|
||||
#
|
||||
# Usage: scripts/load.sh {cpu|alloc|lock|orders|all}
|
||||
set -euo pipefail
|
||||
HOST="${HOST:-localhost:8080}"
|
||||
|
||||
cpu() {
|
||||
echo "6 concurrent fibonacci(38) calls..."
|
||||
for i in 1 2 3 4 5 6; do curl -s "$HOST/api/cpu/fibonacci?n=38" -o /dev/null & done
|
||||
wait
|
||||
}
|
||||
|
||||
alloc() {
|
||||
echo "3 concurrent allocation-churn calls..."
|
||||
for i in 1 2 3; do curl -s "$HOST/api/alloc/churn?iterations=400000" -o /dev/null & done
|
||||
wait
|
||||
}
|
||||
|
||||
lock() {
|
||||
echo "one 16-worker, 20ms-hold lock-contention burst..."
|
||||
curl -s "$HOST/api/lock/contend?workers=16&holdMillis=20"; echo
|
||||
}
|
||||
|
||||
orders() {
|
||||
echo "60 order-processing calls (custom JFR event)..."
|
||||
for i in $(seq 1 60); do curl -s "$HOST/api/orders/process?items=$((3 + i % 5))" -o /dev/null; done
|
||||
echo "done"
|
||||
}
|
||||
|
||||
case "${1:-all}" in
|
||||
cpu) cpu ;;
|
||||
alloc) alloc ;;
|
||||
lock) lock ;;
|
||||
orders) orders ;;
|
||||
all) cpu; alloc; lock; orders ;;
|
||||
*) echo "usage: $0 {cpu|alloc|lock|orders|all}" >&2; exit 1 ;;
|
||||
esac
|
||||
Reference in New Issue
Block a user