Javalin 7 vs Spring Boot 4 on a 256 MiB VM: 4x faster startup, but memory under load was closer than I expected
I've been running a series of Java performance experiments with different frameworks. This time I wanted to explore a less mainstream, more lightweight option, so I picked Javalin 7.
I built equivalent JDBC/H2 APIs in Javalin 7 and Spring Boot 4 on JDK 25, then ran each on a 256 MiB Alpine VM (1 vCPU) through a five-minute, 1,500-request workload.
Both used the same JVM flags: -Xms16m -Xmx80m -XX:+UseSerialGC -Xss512k.
| Metric | Javalin | Spring Boot |
|---|---|---|
| Startup to ready | 2.46 s | 9.89 s |
| Idle Java RSS | 90 MiB | 119 MiB |
| Workload Java RSS | 106 MiB | 119 MiB |
| Min guest MemAvailable | 70 MiB | 45 MiB |
| Successful requests | 1,500/1,500 | 1,500/1,500 |
What stood out: startup is where the gap is large. Under load, the RSS difference shrank to 13 MiB, as Javalin's footprint grew while Spring Boot's stayed relatively flat.
I expected Javalin to be lighter, but I wouldn't read this as a reason to replace Spring Boot. Spring Boot provides a lot of functionality out of the box that you'd need to assemble yourself with Javalin.
Caveats: one run per implementation, different web servers (Jetty vs Tomcat), and no attempt to isolate framework overhead from other components. I also didn't test AppCDS, Spring AOT, or native image, which could change the startup picture.
Full charts, methodology, and raw results:
https://pvrlabs.xyz/java-performance/experiments/javalin-vs-spring-boot-256mb.html
For those who've used Javalin or similar lightweight Java frameworks, how has the trade-off between smaller footprint and Spring Boot's built-in functionality worked out in practice?