#!/usr/bin/env bash # What a too-small buffer does. Every guide picks 2048; nobody says what happens when # an application produces more steps than that. set -uo pipefail source "$(dirname "$0")/env.sh" for cap in 2048 16384; do "$(dirname "$0")/stop.sh" "$JAVA_HOME/bin/java" -Dstartup.tracking=buffering -Dstartup.buffer=$cap \ -jar "$JAR" > /tmp/buf.log 2>&1 & PID=$! for _ in $(seq 1 240); do curl -fs -o /dev/null localhost:8080/actuator/health && break; sleep 0.5; done ok=$? echo "--- capacity $cap ---" if grep -q 'Started StartupDiagnosisApplication' /tmp/buf.log; then echo -n " started, recorded steps: " curl -s 'localhost:8080/diag/startup?top=1' \ | python3 -c "import sys,json;print(json.load(sys.stdin)['recordedSteps'])" else echo " application did not start. Last lines of the log:" grep -E 'ERROR|Exception|Caused by' /tmp/buf.log | head -5 | sed 's/^/ /' fi kill -9 $PID 2>/dev/null; wait $PID 2>/dev/null done true