I've been experimenting with resource-efficient Java applications on small VPS instances, and recently compared five Java stacks using both HotSpot and GraalVM Native Image.
The test environment was a 1-vCPU, 512 MiB Linux VM with colocated MariaDB and no swap. Each application implemented the same small database-backed REST API.
The five stacks were:
The Native Image results were particularly interesting.
Application RSS during the workload:
| Stack | HotSpot | Native Image |
|---|
| Spring Boot | 181–188 MiB | 84–85 MiB |
| Javalin + CoilBase | 121–136 MiB | 58–59 MiB |
| Avaje Jex + CoilBase | ~116 MiB | 33–51 MiB |
| Micronaut Data | 174–175 MiB | 90–92 MiB |
| Micronaut + CoilBase | 167–168 MiB | 82 MiB |
Native Image also improved database-backed readiness substantially. The native applications reached readiness in roughly 0.06-0.27 seconds, compared with approximately 2–9 seconds on HotSpot.
But there were some tradeoffs.
Native compilation took 6-13 minutes per successful build on a separate 2-vCPU, 6 GiB machine. The first Avaje Jex build produced an executable that failed during JDBC startup and required additional native metadata and a rebuild. Micronaut + CoilBase also required a native initialization fix.
So while the runtime savings were significant, the compilation and compatibility costs were not negligible.
A few caveats:
Two accepted runs per configuration, with a light workload of 5 requests/sec.
All five native implementations completed 1,500 measured requests per run without errors, with independent database correctness checks.
Native Image used GraalVM JDK 25 with Serial GC, while HotSpot used JDK 27 with G1. These are whole-stack comparisons, not isolated measurements of native compilation.
RSS represents application process memory, not total system memory or minimum VM requirements.
For context, I developed CoilBase, a small Jdbi-based library, to keep the persistence and business logic reusable across different HTTP frameworks. The Javalin, Avaje Jex, and Micronaut applications use the same shared service and repository implementation, with framework-specific controllers and wiring.
Full article:
https://pvrlabs.xyz/articles/five-java-stacks-512mb-vps.html
Public experiment, methodology, and results:
https://github.com/PVRLabs/experiments/tree/main/java/coilbase-framework-comparison
I'm curious how others weigh Native Image's runtime savings against longer build times and compatibility work. For small services, has Native Image been worth the additional build complexity in your experience?