Benchmarking Java frameworks on a 512 MiB server: Spring Boot, Quarkus, Micronaut and Jex
I've been experimenting with Java applications on memory-constrained servers and have now formalized these comparisons into a reproducible benchmark.
One particularly interesting finding: despite substantial differences in memory consumption and startup time, all four stacks delivered remarkably similar p99 latency under sustained load.
The first published results compare four stacks implementing the same investment portfolio service:
- Spring Boot + JDBC
- Quarkus + Jdbi
- Micronaut Data JDBC
- Jex + Jdbi
Each application runs alongside PostgreSQL 18.7 on a 512 MiB Debian 13 VM with 1 vCPU, no swap and HotSpot 27 (-Xms16m -Xmx80m -XX:+UseG1GC).
Key results:
- All eight runs sustained 40 requests/sec without errors or timeouts.
- Sustained p99 latency ranged from 11.02 to 11.51 ms.
- Sampled peak application RSS ranged from 148 to 233 MiB.
- Application readiness ranged from 4.64 to 10.82 seconds.
The benchmark uses shared correctness checks, a versioned protocol, recorded measurements and automated report generation.
Spring Boot + JDBC is the reference implementation, and the other implementations reproduce its application behavior. The benchmark compares complete SQL-first application stacks rather than isolated framework overhead. The goal is to understand practical trade-offs under realistic resource constraints.
I'm also the author of CoilBase, which the Jex and Quarkus implementations use as a thin integration layer around Jdbi. Given its simple implementation, I expect its overhead to be negligible. It hasn't been measured separately, but I'd be happy to run an isolated comparison if there's interest.
Article: https://pvrlabs.xyz/java-performance/experiments/benchmarking-java-frameworks-512mib.html
Benchmark source: https://github.com/PVRLabs/framework-benchmarks
I'm currently considering two directions for the next comparison:
- Add Helidon to broaden the Java framework comparison.
- Add a Go implementation as a first cross-language comparison, opening the door to community contributions in other languages, such as Rust.
Which direction would you find more interesting? Other suggestions are welcome too.
3
u/mands 6h ago
Super interesting - would love to see Helidon in these benchmarks - found it very lightweight
3
u/Svellere 3h ago
Just a tip, when making benchmark charts, it's best practice to denote whether higher or lower is better.
2
u/TheKingOfSentries 5h ago
Since Jex is pretty much a wrapper on the jdk's built-in server, it's quite interesting to see how competitive it is in these benchmarks. Have you tried using jex with the other httpserver implementations?
2
u/jonenst 4h ago
I'd be interested in the numbers you get when using -XX:TrimNativeHeapInterval=10000 since this is debian13 (glibc). Notably it reclaims memory from the startup (compilations) which is otherwise stuck behind malloc. I don't think it changes the kind of performance (even p99) you are testing at 40rps.
And When memory is more important than performance (for 40rps this should be the case) (although I have not seen any catastrophic performance drop from this) I even use -XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=10 - G1PeriodicGCInterval=10000
If you don't maybe one day i'll try and reproduce your benchmarks and for your benchmarks see what they do!
1
u/Unfair_Ad8967 7h ago
Would be great to see those servers running on GralVM if supported. Plus for memory constrained servers we should make sure we disable unnecessary subsystems like metrics collection, logging, etc.
1
u/nekokattt 5h ago
there are lots of things you can do to reduce spring boot's footprint though.
I'm running a Discord bot using Spring Boot 4.2 + Spring Boot JDBC + Spring Web (for RestClient), but ditched autoconfigure and actuator (as they are the main contributors to slow starts and ballooning memory footprint). Project has over 150 classes in it and about 20,000 lines of code. Non-heap sits at 100MB and heap sits at 20MB
1
u/mencretdimulut 1h ago
try to compare it with other programming language like golang or rust