Supersonic Subatomic Java
For the past several years, I’ve been fascinated by the Microservices movement. The architecture, the promises and how to achieve this. I’ve experimented with frameworks and tools like KumuluzEE, Javalin, Micronaut, Sprint Boot 2, MicroProfile and with the early releases of Quarkus.
Quarkus version 1.0 has just been released and I think that it’s time for a proper introduction.
The migration of a monolithic architecture to a microservice architecture will offer you more agility, scalability and faster business reactivity. You can implement new features more efficiently and more quickly without impacting other services.
What is Quarkus?
Quarkus is designed with the emphasis on Cloud Native, Microservices and Serverless applications. You can use Quarkus for monolithic applications, but it’s not designed for that use case. If offers significant runtime efficiencies, like faster startup (tens of milliseconds), low memory utilization, smaller application and container image footprint. Quarkus brings you the following 4 benefits, which we will dig into below:
- Developer Joy
- Supersonic Subatomic Java
- Unifies Imperative and Reactive coding
- Best of Breed Frameworks and Standards
1. Developer Joy
The platform offers a reload of your application in the blink of an eye. This means that for any change that you make to your code or configuration, the application is immediately reloaded. No need for a new build and no need to restart your application.
Quarkus offers the opportunity to unify all of your configuration in a single file. This can include items like database configuration, properties for different environments or library-specific properties. As a result, there is no longer a need for multiple configuration files.
Generating a native image for GraalVM can be quite a hassle. Quarkus however simplifies this for you tremendously. All you need is the following Maven command line:
mvn package -Pnative.
You can find more information about GraalVM at the project’s official website.
2. Supersonic Subatomic Java
Supersonic refers to the startup time of your application while Subatomic refers to the total memory usage of your application. Because a picture is worth more than a thousand words, I will let it speak for itself:
3. Unifies Imperative and Reactive coding
Quarkus gives you the ability to write imperative and/or reactive coding in a single platform. This is possible due to the fact that Quarkus uses Vert.x and Netty, which form the reactive core of the framework. You can find detailed information about this architecture by reading this blog post.
4. Best of Breed Frameworks and Standards
The Quarkus platform offers you the most used frameworks such as Eclipse MicroProfile, JPA / Hibernate, JAX-RS / RESTEasy, Eclipse Vert.x, Netty and more. Quarkus also includes an extension framework that third-party frameworks can use to extend it. The Quarkus extension framework reduces the complexity for making third-party frameworks run on Quarkus and compile to a GraalVM native binary.
How does Quarkus work?
The startup time of a framework is determined by several processes, for example:
- Parsing configuration files
- Scanning of the classpath & classes (annotations, getters, other metadata, …)
- Build framework metamodel objects
- Prepare for reflections and build proxies
- Start and open IO, threads, …
Quarkus will try to move as much of these processes, except from the last one, from the startup to the build time. Because of that, a lot of the work only has to be done once and not at every startup and less classes need to be loaded. This has a positive impact on memory consumption and startup time.
To go even further you can make use of native compilation for the GraalVM. This process will eliminate as much of the ‘dead’ code as possible. This will further decrease the size, memory consumption and startup time of your application.
As you’ve seen, Quarkus promises you a faster startup and less memory utilization than traditional Java applications. It offers an effective solution for serverless, microservices, containers, Kubernetes, FaaS and the cloud because of its container-first approach. Moreover, you can use imperative and reactive coding due to the fact that it’s a single platform. Quarkus supports the most used frameworks and offers an extension framework that can be used by those frameworks to make it compatible for Quarkus and can be compiled to a GraalVM native executable.
Java Software Crafter
Dominique Claes (36) behaalde een Bachelor Toegepaste Informatica aan de PHL (nu is dit PXL). Momenteel is Dominique aan de slag bij Freo, zusterbedrijf van de Rabo bank, in Eindhoven. Hij werkt aan een document archief systeem op basis van microservices en Cloud.