Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

What I’ve Learned While Building a To-Do App Using Quarkus

DZone 's Guide to

What I’ve Learned While Building a To-Do App Using Quarkus

While it may not be mature enough to be production-ready, Quarkus is still an interesting framework to play with.

· Cloud Zone ·
Free Resource

Image title


Recently I was working on a small project to build a simple browser-based app using Quarkus, JQuery, and Postgresql. The focus was more on learning Quarkus, while the others were complimentary. I was interested to get a first-hand experience on Quarkus and Graal VM. Some readers might be new with these words so let me start with a small introduction on these two projects.

Quarkus is an open source project working with a container-first philosophy to build cloud-native Java-based applications using a microservice architecture. It brings along significant improvement on app booting (a notorious area for improvement for Java-based applications) by build time meta-data processing and most importantly building standalone native images using Graal/Substrate VM. Graal VM applies a technique to statically analyze the classes to determine which classes and methods are reachable and will be used during application execution. Then it passes all this reachable code as the input to the GraalVM compiler which ahead-of-time (AOT) compiles it to the native binary. The native binary runs on a different VM (Substrate VM) that manages runtime components like de-optimizer, garbage collector, thread scheduling, etc.

I was anxious to check whether the native image has really made the booting faster and I am impressed. But the ride was not entirely smooth, mostly of my lack of knowledge (no doubt about that) and the technology has yet to mature. Unfortunately, StackOverflow is not overflowing with the required information!

A few more things to note:

  1. The project quite resources intensive to build (to be specific, native-image build). The first I tried to build on Google Cloud shell followed by a virtual box VM (2 CPU, 4 GB RAM), and I failed both times! It’s surprising considering I was building not more than 10 source code files. Finally, I managed to get going on a GCP n1-standard-2 (2 vCPUs, 7.5 GB memory), which worked smoothly.
  2. The Maven plugin probably needs some improvement. While the plugin does quite well creating a scaffolding and adding extensions, a few more features would have been appreciated, like listing all extensions available in a project and removing extensions from the project. Finally, after creating the native build, mvn clean fails as there are directories created under target/ with root permissions. You'll have to go and manually delete them.
  3. The extension and guide lists are quite long. At the time of this writing, there are around 13 categories of extensions. Some of the extensions are quite interesting, like Kubernetes and lambda extensions, worth trying!
  4. Setting up Graal VM was another tricky area. Quarkus supports the Community Edition 1.0 RC16 of Graal VM, at the time of this writing. Also, importance has to be paid to installing the required OS packages as mentioned in the Quarkus guide, which can be found here and setting JAVA_HOME and GRAALVM_HOME .
  5. The native binary build failed multiple times due to Jandex index failure. I found some interesting solutions on StackOverflow, which can be found here. However, it did not work for me. An alternate solution that worked was available on GitHub issue logs is to execute mvn clean install -DskipTests -DskipITs before building the native binary. Hope this will be fixed in the next version.
  6. I was not able to externalize hibernate properties as Docker will not be able to talk to back end the PostGreSQL Docker on localhost. The solution is straigtforward can be found here.
  7. Deploying to Kubernetes has been made super easy. After adding the Kubernetes extension, you can run mvn package and the Kubernetes deployment manifest will be at target/wiring-classes/META-INF/kubernetes/kubernetes.yml . Apply changes if required and deploy them using kubectl.

Image title


Quarkus is built using other popular open source projects like Microprofile, Hibernet, Vert.x, RestEasy, and many others. It has been backed by tech majors like Oracle and Redhat. Personally, I find it to be an interesting tool to work on, but it has not matured enough to be production-ready yet, but has the potential to become a good alternative for Spring Boot.

Topics:
quarkus ,graalvm ,docker ,kubernetes ,cloud ,java based application

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}