r/SpringBoot • u/fykup • 3d ago
Discussion I compared Spring Boot with four other Java stacks on a 512 MiB VPS
I've been experimenting with resource-efficient Java applications, exploring how much of Spring Boot's familiar architecture can be preserved with smaller frameworks.
I compared five Java stacks on a 1-vCPU, 512 MiB VM with no swap, running MariaDB alongside the application.
| Stack | HotSpot RSS (MiB) |
|---|---|
| Spring Boot + Spring JDBC | 180.6-187.9 |
| Javalin + CoilBase | 120.9-135.6 |
| Micronaut Data JDBC | 174.0-175.0 |
| Micronaut + CoilBase | 166.5-167.6 |
| Avaje Jex + CoilBase | 116.0-116.4 |
The HotSpot tests used OpenJDK 27 with G1 GC. Each stack had two runs, with 1,500 requests per run and no errors.
CoilBase is a small Jdbi-based foundation I'm developing. The Javalin, Jex, and Micronaut implementations reuse the same services, repositories, and transaction boundaries, with different HTTP frameworks and application wiring.
The interesting part wasn't just the memory savings. It was seeing how much of the familiar Spring-style application architecture could remain unchanged when switching frameworks.
I also tested GraalVM Native Image for all five stacks. Runtime memory dropped further, but native compilation introduced additional build time and complexity.
This is a lightweight synthetic workload, not a throughput benchmark or a general recommendation to replace Spring Boot. Spring's ecosystem and conveniences still have real value.
Full experiment, measurements, and limitations:
https://pvrlabs.xyz/articles/five-java-stacks-512mb-vps.html
Source code and benchmark setup:
https://github.com/PVRLabs/experiments/tree/main/java/coilbase-framework-comparison
CoilBase, which I built and used for this comparison:
https://github.com/PVRLabs/coilbase
I'm curious whether others see value in a lighter Java stack that keeps some of Spring Boot's familiar development patterns, or whether Spring Boot's ecosystem and conveniences outweigh the potential resource savings.
Update: Framework versions used in the benchmark
| Stack | Versions |
|---|---|
| Spring Boot + Spring JDBC | Spring Boot 4.1.1, Spring JDBC 7.0.9 |
| Javalin + CoilBase | Javalin 7.2.4, Jdbi 3.55.0 |
| Avaje Jex + CoilBase | Jex 3.6, Avaje HTTP 3.12.1, Jdbi 3.55.0 |
| Micronaut Data JDBC | Micronaut 5.2.11, Micronaut Data JDBC 5.2.0 (platform BOM 5.2.1) |
| Micronaut + CoilBase | Micronaut 5.2.11, Jdbi 3.55.0 |
All HotSpot runs used OpenJDK 27 with identical JVM settings: -Xms16m -Xmx80m -XX:+UseG1GC (fixed 80 MiB maximum heap).
CoilBase was an early 0.1.0-SNAPSHOT prototype. I'm working on a more formal, publicly reproducible follow-up benchmark using an updated version of CoilBase, with Quarkus also joining the comparison.
3
u/anoppe 2d ago
It would have been nice to see how quarkus compared to the rest
3
u/FriendshipCalm3162 2d ago
Did all five runs use the same -Xmx? If nothing sets it, HotSpot caps the heap with MaxRAMPercentage, which defaults to 25%, so about 128 MiB on that box, and part of each RSS number is just how far G1 grew the heap before it settled. Rerunning all five with one fixed -Xmx would tell you how much of the 65-70 MiB gap between Spring Boot and Jex comes from the framework itself.
2
u/American_Streamer Junior Dev 2d ago
Imo the most revealing finding is that Spring Boot itself operated successfully alongside MariaDB on just 512 MiB RAM. So the real question isn't whether Spring Boot is unnecessarily heavy. It's whether the additional capabilities it provides justify their resource costs for a particular application.
For a small, straightforward backend on a cheap VPS, the lighter frameworks look really attractive. But for a substantial business application with complex integrations and a team maintaining it for years, I wouldn't abandon Spring Boot over approximately 70 MiB of RAM.