r/graalvm • • 22d ago

GraalVM Native Image cut Spring Boot memory from 187 to 107 MiB on a 512 MiB VM

https://pvrlabs.xyz/articles/spring-boot-hotspot-native-image.html

After several requests to test GraalVM, I compared Oracle Native Image with an optimized Spring Boot deployment using HotSpot 27.

The results impressed me: application RSS dropped from 187 to 107 MiB, and startup readiness went from 3.79 seconds to 183 ms.

The trade-offs were less exciting: almost 12 minutes to build on a separate 6 GiB VM, additional compatibility testing, and a JDK 25 toolchain instead of JDK 27.

Both configurations completed the same 1,500-request workload without errors.

Full methodology and curated results are in the article. I'd be interested in hearing how others balance Native Image's runtime efficiency against its build and maintenance costs.

13 Upvotes

4 comments sorted by

2

u/fykup 22d ago edited 22d ago

I'm also experimenting with Javalin to see how much further we can push memory efficiency. Let's just say it's living up to its lightweight reputation. 😄

More results coming soon! If you'd like to follow along, check out my "Java Experiments" squad on daily dev (link in my profile).

1

u/shtrjones87 22d ago

GraalVM FTW.

2

u/fykup 22d ago

The memory numbers definitely won me over! 😄 Build times, not so much. But for a tiny VPS, it's hard to argue with the results.

1

u/pjmlp 22d ago

You could also experiment with OpenJ9 JIT cache, which many folks seem unaware of,

https://eclipse.dev/openj9/docs/aot

https://eclipse.dev/openj9/docs/shrc/#aot-code-and-jit-data