Micronaut benchmarks: Faster than Quarkus and Spring Boot?
OCI Grails & Micronaut Product Lead and Principal Software Engineer, Graeme Rocher, published a report comparing the speeds of Micronaut, Quarkus, and Spring Boot on JDK 14. Which is the fastest and which has the lowest memory consumption?
What do we want? Speed. Which is the fastest microservice framework? Quarkus, Micronaut, and Spring Boot are three modern frameworks for Java that share a similar overlap of features and capabilities.
While all three services have their pros, cons, and unique use cases, they are often pitted against each other.
Which is the fastest and which has the lowest memory consumption?
Quarkus, Micronaut, and Spring Boot
Let’s take a quick rundown of all three frameworks.
Developed by Red Hat, Quarkus is a “supersonic subatomic Java”, which is not only fun to say, but a perfect description. It is a Kubernetes-native Java stack designed for OpenJDK HotSpot and GraalVM and includes the best Java libraries and standards. One of the pros of Quarkus is its speedy start-up time.
Micronaut is a cloud-native JVM-based polyglot full-stack framework for building microservices and serverless applications. It features low memory consumption, no matter the size of your codebase. Check out the guide for Micronaut 2.0.0.M2 release.
Spring Boot is an open source Java framework that makes it easy to create stand-alone production-grade Spring applications and microservices with embedded Tomcat, Jetty, or Undertow. Spring Boot apps require little configuration so they can “just run”.
All of these frameworks claim speed, but only one can be the fastest.
Putting them to the test
OCI Grails & Micronaut Product Lead and Principal Software Engineer, Graeme Rocher published a report comparing the speeds of Micronaut, Quarkus, and Spring Boot on JDK 14.
The test looks at Micronaut 2.0 M2, Quarkus 1.3.1, and Spring Boot 2.3 M2 on JDK 14 using a 2019 iMac Pro Xeon 8 Core.
Here are the results of the benchmark test, taken from an average of 10 runs:
The test confirms that Quarkus’ boot time is unmatched with a time to first response of 890ms. Spring is the best at compilation time with 1.33s for a ./mvn clean compile. (Graeme Rocher notes that this is because Spring does not perform any compilation-time processing.)
However, as you can see from the table, in every other task, Micronaut takes the lead and has the lowest memory consumption after load test of the three.
Graeme Rocher writes:
The Quarkus team has made bold claims about the memory efficiency of Quarkus, so it was surprising to see such a disparity when actual tests were conducted that seem to disprove these claims. The Micronaut team and I are disappointed that we had to take it upon ourselves to perform these tests and publish the results, not as a simple opportunity to help others improve their processes and applications, but to respond to misinformation that could, theoretically, do the opposite.
In order to prevent reporting bias, the source code for the examples is available on GitHub for users to test out for themselves on their own machine.
At the end of the day, the key takeaway here is that all three are quite fast. The Micronaut, Quarkus, and Spring frameworks all have great performance that will likely only continue to improve with future updates.
Do your numbers differ? Which JVM framework do you prefer?