Startup time matters more than it used to. Autoscaling, spot instances and scale-to-zero all turn a slow boot into a user-visible latency.
Measure before you tune
Spring publishes startup steps as an ApplicationStartup recording. Point it at a FlightRecorder and you get a tree with timings instead of a guess. Every time I have done this the answer was different from the folklore.
The most expensive bean is usually the one that talks to something outside the process.
What tends to help
- Lazy initialisation for the beans that are genuinely only used by one endpoint.
- Explicit component scanning paths instead of scanning a whole parent package.
- Deferring connection-pool warm-up past the readiness probe, not before it.
We took one service from 41 to 12 seconds without touching a single line of business logic.
Tags:
1 Comments
Leave a comment
Sign in to leave a comment.
Signing in is unavailable right now.







Lotte Jansen
June 20, 2024The readiness probe ordering caught us too. We were warming the pool before the probe and wondering why rollouts took so long.