Backend Development 14 min read

Optimizing Spring Application Startup Time and Performance: Analysis, Tools, and Practical Steps

This article examines the causes of slow startup in large Spring applications, presents visual analysis techniques and a toolbox—including Arthas, JVM Sandbox, Async Profiler, and Spring Startup Analyzer—and provides concrete installation, configuration, and optimization procedures that can reduce startup time by 70‑80% while improving development efficiency and resource utilization.

JD Retail Technology
JD Retail Technology
JD Retail Technology
Optimizing Spring Application Startup Time and Performance: Analysis, Tools, and Practical Steps

As Java developers increasingly rely on the Spring framework, the importance of fast startup and performance optimization for large applications becomes critical. This article explores how to significantly improve Spring application startup speed and runtime performance through professional analysis and optimization techniques, addressing development bottlenecks and rapid scaling needs.

Current Situation and Background – Spring’s flexibility comes with complex dependencies that can cause long startup times (often several minutes) in large applications, slowing development, debugging, and scaling. Reducing unnecessary dependencies, applying asynchronous initialization, and lazy loading can dramatically improve startup performance.

Key Topics Covered

Spring Bean loading timeline visualization

Spring Bean dependency analysis

Unused JAR detection (JAR slimming)

Thread wall‑clock flame graph of the startup process

Importance and Impact

Development efficiency : Faster startup reduces time spent on launching, testing, and debugging.

Deployment and scaling : Shorter startup lowers deployment cost and improves system elasticity.

Resource utilization : Less initialization time reduces CPU and memory consumption.

Analysis Tools

Arthas : Open‑source Java diagnostic tool for real‑time monitoring of startup resource consumption.

JVM Sandbox : Uses Java security manager to isolate and limit access, helping reduce startup overhead.

Async Profiler : Low‑overhead asynchronous profiler for identifying bottlenecks during startup.

Spring Boot Startup Report : Generates detailed bean loading and auto‑configuration timing.

Jaeger UI : Visualizes distributed tracing data for startup analysis.

Spring Startup Analyzer : Collects startup data, produces interactive HTML reports, and supports asynchronous bean initialization.

Spring Startup Analyzer Optimization Flow (example: ARK project)

First, observe the baseline startup metrics (time, bean count, used/unused JARs, classloader count). The article includes several screenshots illustrating the timeline, bean details, and flame graphs.

Implementation and Results

After applying the optimizations, the following improvements were observed:

Local development and debugging became feasible, greatly increasing developer productivity.

Pre‑release build and verification time were reduced, accelerating iteration cycles.

Overall startup time decreased by 70‑80% (e.g., from ~10 minutes to ~2 minutes on Intel machines, ~90 seconds on M1).

The approach is applicable to most Spring and Spring Boot projects and should be performed regularly.

Key Optimization Steps

Remove unused JARs identified by the analyzer.

Identify and optimize slow‑initializing beans (e.g., lazy loading, asynchronous initialization).

Disable unnecessary publishing (e.g., JSF services) during local development.

Enable global lazy loading where appropriate (caution: not recommended for production on Kubernetes).

Split large components to load only required parts.

Use performance analysis tools (Spring Startup Analyzer, Async Profiler, VisualVM, etc.) to locate bottlenecks.

Apply caching, parallel processing, and regular code refactoring to further improve performance.

Installation and Configuration of Spring Startup Analyzer

Manual installation:

mkdir -p ${HOME}/spring-startup-analyzer   # create installation directory
tar -zxvf spring-startup-analyzer.tar.gz -C ${HOME}/spring-startup-analyzer

Script installation (Linux/macOS):

curl -sS https://raw.githubusercontent.com/linyimin0812/spring-startup-analyzer/main/bin/install.sh | sh

Run the application with the agent:

java -javaagent:/path/to/spring-startup-analyzer/lib/spring-profiler-agent.jar \
    -Dproject.name=mac-demo \
    -Dspring-startup-analyzer.admin.http.server.port=8066 \
    -jar /path/to/ARK.jar

In IntelliJ IDEA, add the same -javaagent option to the VM options.

Log files are written to ${HOME}/spring-startup-analyzer/logs (e.g., startup.log , transform.log ).

Resulting Startup Metrics

Before optimization: average pre‑release startup ~10 minutes, 585 JARs with 337 unused.

After optimization: local startup ~131 seconds (with bean lazy loading) and further reduced to ~185 seconds after fixing JSF registry delays; overall reduction of 70‑80%.

These steps demonstrate a systematic method to analyze and accelerate Spring application startup, yielding measurable gains in development speed and resource efficiency.

backendJavaperformancestartup optimizationSpringprofilingJar Slimming
JD Retail Technology
Written by

JD Retail Technology

Official platform of JD Retail Technology, delivering insightful R&D news and a deep look into the lives and work of technologists.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.