A lot of new languages have been introduced in the last few decades. This has given developers a lot of options to choose from. However, Java has been able to withstand harsh competition and is still one of the most popular languages used and recommended by developers.
In the last few years, we have seen the introduction of new frameworks or toolkits besides Spring, which claim to improve the startup time and memory footprint of Java applications. However, Spring Framework has been the default framework used by developers as it is easy to use and efficient.
So, a question may arise, which of the frameworks is better? That is why, today, we are going to discuss the difference between Quarkus, Spring Boot, and MicroNaut and decide which of them is better.
Frameworks’ Main Features
Before we move on to compare these three frameworks, let us get a brief idea about them.
Spring was introduced in 2003. Its initial objective was to reduce the complexities of early Java Enterprise. What started as dependency injection and an aspect-oriented programming framework converted into a simple developer-friendly web app framework.
Thanks to Spring, developing using Java has been easier and more productive than ever before. Developers are now able to create and maintain applications with ease. However, despite its developer-friendly nature, it is infamous for its slow startup and high memory consumption.
Introduced in 2018, MicroNaut was introduced to tackle the flaws of the Spring Boot Framework. It was introduced by the creators of the Grails framework. It is at present maintained by Object Computing Inc. The developers of MicroNaut designed it based on the experiences gained while working with Springs and Grails frameworks.
It contains everything you need to build fully functional microservice applications. It has modules like HTTP, security, etc., but they are not developed enough to compete with their Spring counterparts.
Quarkus was introduced in 2019 with similar objectives as MicroNaut. While Quarkus uses custom Maven plugins to perform work during compile time instead of build time, Micronaut achieves the same goal by using Java annotation processors to perform DI.
Developed and backed by RedHat, Quarkus has recently gained popularity. It also promises to deliver faster startup and reduce memory consumption. It uses standard technologies at present but has scopes for expansion.
These two frameworks have led to a smaller memory footprint since there is no need to store reflection metadata and faster runtime. This, in addition to faster startup time, has made a large difference. Nowadays, one can use a cheaper device to run Java apps.
Quarkus vs Spring Boot vs MicroNaut Compared
We compared these three frameworks in multiple categories, and here are the results that we found out.
In the case of IDEs, since we have been using the Spring Boot framework as a standard for so many years, we are going to skip it. Besides that, Quarks has two dedicated plugins for IntelliJ IDE, one of which can be used for building and debugging already existing applications. The other one supports project bootstrapping with code assistance.
However, not all IDEs have MicroNaut support. In the IntelliJ IDE, you cannot get MicroNaut support unless you have IntelliJ Ultimate. Even in Eclipse, the MicroNaut plugin works by resting on Gradle and Maven plugins.
Ease in Use
Even though these new frameworks are introduced, Spring Boot is still the easiest to use, in our opinion. The documentation and the information available make it easier for developers. It is the best framework for beginners.
MicroNaut has pretty good documentation as well. So, anyone familiar with Spring Boot will have no difficulty getting used to it.
Learning and adjusting to Quarkus is a bit harder compared to the others. The API and libraries are still not developed enough.
In our test, Spring Boot took about 8.16 seconds to boot. We reduced the booting time to 5.8 seconds by removing JPA and Spring Data.
However, both MicroNaut and Quarkus kept their promise by booting up really fast. MicroNaut took only 5.08 seconds to boot using JPA and 3.8 seconds using JDBC. Quarkus was slightly faster, with a booting time of 5.7 seconds.
Spring Boot supports Java, Kotlin, Apache Groovy. It also provides dynamic language support. That means you can write as many classes as you want in a supported language. Spring will automatically detect, translate, and DI the objects.
MicroNaut supports Java, Kotlin, and Groovy. At the same time, Quarkus has Java, Kotlin, and Scala.
Thus, Spring Boot has greater language support.
Here also, the new frameworks delivered as the devs had promised. Just after the boot, Spring was consuming 420MB of memory when using Spring Data and 261Mb when using JDBC.
MicroNaut consumed 262MB memory when using JPA and 178MB using JDBC.
Quarkus performed much better than the other frameworks as it consumed only 197MB.
However, these numbers are the memory consumed just after boot. We observed the memory consumption after putting a heavy load on all of these frameworks. And that changed the scenario.
Spring Boot was pretty efficient under load. It was able to serve 342 requests per second using Spring Data and consumed 581MB. When using JDBC, it was able to handle 216 requests per second by consuming 484MB of memory.
Quarkus handled 197 requests/second on OpenJDK and consumed only 255MB of memory. When running as a native image, it took 368MB.
The biggest change that we saw was that MicroNaut is not efficient at all under heavy load. It was using about 880MB when running in OpenJDK. It is consuming more than SpringBoot and is highly wasteful.
The compilation time of Spring Boot and Quarkus frameworks when using JDK is quite similar. Spring Boot using JDBC took 6.98 seconds. Quarkus was a bit slower at 10.7 seconds.
However, MicroNaut is way too slow! MicroNaut took 231.2 seconds using JDBC and 351.7 seconds using JPA when generating native images. This long compilation time makes the development of native programs highly impractical, as it is too much.
We have tried to rank these three frameworks based on the number of requests they could handle per second at peak. MicroNaut can handle 79K requests per second in an average of ten runs. Quarkus could handle 75k requests per second under similar conditions.
We could not determine the request handling capacity of Spring Boot. Hence, MicroNaut is the winner in this category.
MicroNaut and Quarkus have delivered as promised. They have reduced the startup time by a lot. However, the MicroNaut consumed less memory only when under low load. According to our observations, Quarkus was the winner.
When it comes to developer experience, Spring Boot is still the best framework to build microservice applications even though it has high startup times. Also, it is one of the easiest frameworks to learn. Even though Quarkus was the winner in different categories, it is still not developed enough and hard to learn.
So, when comparing these three, none of them have a massive advantage over each other. So you can choose any one of them based on your preferences.