Spring Boot startup time: bean-by-bean diagnosis, and one directory per post

Adds spring-boot-startup-time/, the companion project for BLOG-618: a runnable
Spring Boot 4.1.1 application on JDK 25 that installs BufferingApplicationStartup
and FlightRecorderApplicationStartup behind a system property, and a /diag/startup
endpoint that computes step self time -- the number /actuator/startup does not give
you and the one that names the actual culprits.

Captured under docs/output/: the step tree sorted both ways, the same startup as JFR
events, a +5000-class experiment putting 0.11 ms per scanned class on the classpath
scan tax, the silent truncation a 2048-step buffer performs, and JDK 25 AOT cache
timings (6.93 s to 4.82 s). Post body and metadata live in post/.

Moves the existing Actuator project into actuator-in-production/ so the repository
holds one directory per article; the root README is now an index.
This commit is contained in:
2026-09-04 23:58:38 +05:30
parent 4b6cefa60a
commit 958b401f0f
112 changed files with 2744 additions and 154 deletions

View File

@@ -0,0 +1,24 @@
#!/usr/bin/env bash
# A health indicator with no timeout, and what it does to the endpoint.
set -uo pipefail
cd "$(dirname "$0")/.."
OUT=docs/output/10-slow-upstream.txt
B=http://localhost:8080
{
echo "### profile: details upstream deliberately sleeping 30s per request"
echo "### demo.upstream.timeout-ms = 750, so the indicator gives up long before the stub replies"
echo
curl -s -o /dev/null -u ops:ops-password -X POST "$B/stub/upstream/mode?value=slow"
sleep 1
echo "\$ time curl -s $B/actuator/health/externalApi"
s=$(date +%s.%N)
curl -s -u ops:ops-password --max-time 60 "$B/actuator/health/externalApi" | python3 -m json.tool
e=$(date +%s.%N)
printf 'wall clock: %.2f s\n' "$(echo "$e - $s" | bc)"
echo
echo " The read timeout is what bounds this, not the endpoint. Remove setReadTimeout from"
echo " ExternalApiHealthIndicator and this call blocks for the full 30 seconds, holding a"
echo " Tomcat worker the whole time."
curl -s -o /dev/null -u ops:ops-password -X POST "$B/stub/upstream/mode?value=up"
} > "$OUT" 2>&1
echo "wrote $OUT"