Learn about Quarkus – Supersonic Subatomic Java

Tram Ho

Today, writing an application and deploying to the cloud is very common and there is no need to worry about infrastructure. Serverless and FaaS have since been more popular than ever.

Serverless is the environment, the platform to execute applications and services without having to care about the server. Serverless applications do not need to care about allocating, managing operating system resources, and ignoring upgrade and security issues. With the concept of just focusing on product development, the rest of the operation will be left for the platform to take over.

In addition, Microservice is a type of software architecture in which the modules in this software are divided into very small services (microservice). Each service will be located on a separate server, so it will be easy to upgrade and scale the application.

These services (maybe called apps) run on many servers located in the cloud, each service is encapsulated in containers, we call them Cloud Native Microservices .

A little bit free ?

In this type of environment, when running the application, instances (containers) are created and destroyed regularly (Every time a deploy, one or several new instances are created, some old intance will be removed). The time it takes to boot up and the time it takes to receive the first request is really important, as it contributes to creating a completely different user experience.

Other languages ​​like Javascript or Python are always designed to run better in this type of environment. Meanwhile, Java with huge jar libraries, long boot time should never be a bright candidate to run on serverless environment.

1. What is Quarkus

Due to the limitations of Java, JVM when running in containers (memory consumption + slow boot time), Quarkus was born. A framework described as the Supersonic Subatomic helps run compatibility in containers in the cloud environment.

Quarkus is truly an alternative to help bring Java closer to cloud environments.

2. QuarkusIO

QuarkusIO promises to provide small artifacts, extremely fast startup times and lower first-time requests than other Java Frameworks. When combined with GraalVM, Quarkus will compile ahead of time (AOT).

Quarkus is built on standard libraries, so we won’t need to relearn many things. For example, we can use CDI, JAX-RS and many other things similar to java frameworks. Can be combined using Hibernate, Kafka, OpenShift, Kubernetes, and also Vert.x, …

3. Quarkus start coding

Similar to spring boot, quarkus also has a tool to help you create base projects easily. Just select the library you want, and click generate

In addition, you can also use maven to manage your project, from creating a base project to adding extensions, for example:

4. Hot reload

When run in develop mode ( ./mvn compile quarkus:dev ), Quarkus has the ability to hot reload. When you change a Java file or simply a config file, want the server to automatically recompile, you just need to reload the browser. It seems that this feature is not new, because it is also included in the Spring framework.

5. Cloud and cloud

Quarkus has many more things (e.g., native image, native executable, …), but this is just a warm-up, we will take a closer look at what Quarkus can do without being inferior to frameworks like Spring in Other posts in the series ?

5. In a nutshell

Those are some of the key prominent elements of Quarkus. Quarkus is really one of the best frameworks (in the future, in my opinion), which developers are paying attention to. In particular, Quarkus is supported by Redhat, so it can be said that the future ahead cannot be brighter.

I believe that Quarkus will blow a new wind into Java – a language that is too old but still handsome, medium and large enterprises will gradually switch to use when the trend of cloud native microservices is becoming trendy.

A little more ? Kubernetes + Knative + Quarkus are a trio of Java programmers (Kotlin) to try ?

Share the news now

Source : Viblo