Is Javalin much lighter than Spring Boot on a 512 MiB server?

November 18, 2026 4 answers
Asked by q.816!gobletcaper

For a small database-backed Java service on a 512 MiB server, how much difference does Javalin make compared with Spring Boot? Are the HotSpot and GraalVM tradeoffs different?

Answers

4h+drivnexa_592

In one comparison of complete applications, Javalin with Jdbi used less application memory, but the size of the gap depended on the runtime. On HotSpot, median app RSS was 159.1 MiB for Javalin versus 186.9 MiB for Spring Boot. Readiness was 2.72 seconds versus 3.79 seconds, and HTTP p95 was roughly 5.6 ms for both.

With GraalVM Native Image, median app RSS was 65.5 MiB for Javalin versus 107.0 MiB for Spring Boot. Readiness was 0.113 seconds versus 0.183 seconds, with p95 at 4.34 ms and 4.84 ms respectively. Both completed 1,500 of 1,500 requests in each test.

That's a useful comparison, not a universal framework ranking. The Spring application used Spring AOT and a JDK AOT cache, and the tests ran on a single 1 vCPU machine alongside MariaDB and a small HTTP fixture. Single runs under those conditions can be noisy.

6v!marzipanlever_413:

Repeated runs would help show how much of the gap survives normal variation, especially with the database sharing that one CPU.

Reply to this answer
Varnexo.4k

Don't budget the server by application RSS alone. In the native test, Javalin's process was 41.5 MiB smaller, yet minimum host MemAvailable was almost identical: 204.1 MiB versus 204.9 MiB for Spring.

Both apps shared the VM with a database, so watch the whole machine under your own workload as well as the Java process. A lower process number doesn't necessarily mean you get that much extra usable host memory.

Reply to this answer
4n~mivdelo_827

The framework choice is also about what you want to assemble yourself. Spring Boot brings integrated MVC, persistence, transactions, health checks, metrics and application wiring. Javalin is lighter, but those responsibilities need explicit choices and wiring.

Jdbi can handle the database access side, with explicit transaction callbacks if that suits the service. Whether another repository abstraction is worth adding on top is a separate design question, not something the memory numbers settle.

Reply to this answer
2n~vexlori_759

Native Image looks attractive here if startup time and process footprint matter, but compare it separately from the HotSpot builds. The reported tests used different JDK versions for HotSpot and GraalVM, so the runtime results aren't a clean measurement of just one setting changing.

For a service that stays up for a long time, the smaller startup difference may matter less than whether the application and database fit comfortably together.

q.816!gobletcaper:

Good point. The whole VM fitting comfortably matters more to me than shaving a second off startup.

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions