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,57 @@
# Post metadata
## Title
Why Your Spring Boot App Takes 8 Seconds to Start: A Bean-by-Bean Diagnosis
## Slug
`spring-boot-startup-time-bean-by-bean-diagnosis`
## Excerpt
Spring Boot logs one startup number and hides four phases behind it. This walks through
turning on the `ApplicationStartup` instrumentation that ships switched off, reading the step
tree by self time rather than total duration — the mistake that makes people optimise a bean
costing 10 ms instead of the one costing 504 — and then puts measured numbers on component
scanning (0.11 ms per class inspected, whether or not it is a bean), on the silent truncation
a 2048-step buffer performs on your recording, and on the JDK 25 AOT cache, which took
6.93 s to 4.82 s on the companion project without a line of application code changing.
## Categories
| Category | Term ID |
|---|---|
| Java | 328 |
| Spring | 355 |
## Yoast
| Field | Value |
|---|---|
| `_yoast_wpseo_title` | Spring Boot Startup Time: A Bean-by-Bean Diagnosis |
| `_yoast_wpseo_metadesc` | Turn on Spring Boot's built-in startup instrumentation, read the step tree by self time, and see measured numbers for component scanning, buffer truncation and the JDK 25 AOT cache. |
| `_yoast_wpseo_focuskw` | spring boot startup time |
## Files
| File | Contents |
|---|---|
| [`post.md`](post.md) | article body, Markdown |
| [`images/01-self-time-vs-total-time.svg`](images/01-self-time-vs-total-time.svg) | the same 400 steps ranked by total duration and by self time |
| [`images/02-buffer-truncation.svg`](images/02-buffer-truncation.svg) | what a 2048-step buffer keeps and what it silently drops |
## Companion project
[`spring-boot-startup-time/`](..) in `asmhatre/spring-boot-demo`.
## Jira
[BLOG-618](https://ankurm.atlassian.net/browse/BLOG-618)
## Verified against
Spring Boot 4.1.1 (GA 20 August 2026), Spring Framework 7.0.9, Spring Data JPA 4.1.1,
Hibernate ORM 7.4.5.Final, Tomcat 11.0.24, Micrometer 1.17.1, H2 2.4.240,
Temurin 25.0.4.1+1 LTS, Maven 3.9.11 — see
[`docs/output/00-versions.txt`](../docs/output/00-versions.txt).