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.
The latest version of MicroNaut (version 2.0 M2) has a reduced Start Time of 420ms in Dev Mode, whereas the latest versions of Quarkus (version 1.3.1) and Spring Boot (version 2.3 M3) have a startup time of 866ms and 920ms, respectively. In production mode, however, the MicroNaut framework has an increased start time of 510ms, and the Spring Boot framework has that of 1.24s, whereas the start time of Quarkus got reduced to 655ms.
The time of first response of MicroNaut 2.0 M2, Quarkus 1.3.1, and Spring boot 2.3 M3 are 960ms, 890ms, and 1.85s, respectively.
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 loads. It was using about 880MB when running in OpenJDK. It is consuming more than SpringBoot and is highly wasteful.
There has been a significant change in memory consumption after the release of MicroNaut 2.0 M2, Quarkus 1.3.1, SpringBoot 2.3 M3, and JDK 14. The memory consumption after load for MicroNaut reduced to 290MB, Quarkus to 390MB and SpringBoot to 480MB (for Xmx128m), and the memory consumption after load for MicroNaut reduced to 249MB, Quarkus to 340MB, and SpringBoot to 430MB (for Xmx18m).
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.
The latest MicroNaut 2.0 M2 has a compilation time of about 1.48 seconds, Quarkus 1.3.1 can do that in about 1.45 seconds, and Spring Boot 2.3 M3 can do that in about 1.33 seconds. The new test times for MicroNaut, Quarkus, and Spring Boot are 4.3 seconds, 5.8 seconds, and 7.2 seconds, respectively.
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.
The latest MicroNaut 2.0 M2 can now handle 79k requests per second (Xmx128m) and 50k requests per second (Xmx18m). Quarkus 1.3.1 can handle 75k requests per second (Xmx128m) and 46k requests per second (Xmx18m). The requests per second for Spring Boot 2.3 M3 could not be measured.
The development experience of using Quarkus, MicroNaut, or Spring Boot is comparable. There are a number of seasoned technologies integrated within Quarkus, so some things do not provide a fully new experience. On comparing with the projects on Spring Boot, the technologies of Quarkus are still misaligned with each other.
The declarative nature of the MicroNaut framework makes it way more comparable to Quarkus. It is very similar to Quarkus and has out-of-the-box technological support.
The earlier versions of MicroNaut and Quarkus could outperform Spring Boot only when idle or under a small load. However, under a heavy load, Spring Boot served better performance. The latest versions of MicroNaut and Quarkus have got this problem fixed.
The developer experience of Spring Boot is by far the best and is beginner-friendly. It is the optimal framework for microservice applications even though it has a poor startup and idle performance.
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.