avatarRuby Valappil

Summary

Quarkus is an open-source, cloud-native framework designed for building lightweight, fast, and efficient Java applications, particularly for microservices and serverless architectures, and is positioned as an alternative to Spring Boot.

Abstract

Quarkus is a modern Java framework developed by Red Hat, focusing on optimizing Java for cloud-native and containerized environments. It aims to address the traditional shortcomings of Java, such as high memory consumption and slow startup times, by compiling applications into native executables using GraalVM Native Image. This results in a significant improvement in startup speed and memory efficiency. Quarkus is compatible with MicroProfile and Jakarta EE standards, allowing developers to utilize a wide range of existing Java libraries. It is also designed to be Kubernetes-native, offering seamless integration with Kubernetes features. While the author found the initial setup for Quarkus more challenging compared to the familiar Spring Boot ecosystem, they acknowledge the potential of Quarkus in cloud-first environments and encourage developers to explore its capabilities.

Opinions

  • The author considers Spring Boot their preferred choice for Java-based service development but recognizes the value in exploring alternatives like Quarkus.
  • Quarkus is seen as a project aimed at modernizing Java applications for cloud-native and serverless paradigms.
  • The author notes that Quarkus's community-driven development is crucial for its continuous improvement and evolution.
  • Despite finding Quarkus's setup more challenging than Spring Boot's, the author suggests that this could be due to their greater familiarity with Spring projects and the extensive community support available for them.
  • The author encourages developers to try Quarkus and form their own opinions, emphasizing the importance of exploring new technologies in the field of software development.

What is Quarkus? Is it an alternative to SpringBoot?

Photo by Boitumelo on Unsplash

I was looking for an alternative to Spring Boot once, and a fellow programmer on Twitter suggested I try Quarkus.

Spring Boot is still my favorite to develop Java-based services, but there is no harm in exploring alternatives. From my analysis so far, Quarkus is aimed at cloud-native, microservices, and serverless development.

That is, it comes with the tools that’s needed for a cloud-first environment.

Quarkus is an open-source project developed and sponsored by Red Hat. Red Hat engineers initiated the project and has since gained contributions from a diverse community of developers worldwide.

Quarkus is part of Red Hat’s efforts to modernize Java for cloud-native and containerized environments. Red Hat sees Quarkus as a key technology to enable developers to build lightweight, fast, and efficient Java applications that are well-suited for microservices and serverless architectures.

As an open-source project, a community-driven process governs Quarkus, and contributions from various organizations and individuals play a crucial role in its evolution and improvement.

Quarkus is a cloud-native and Kubernetes-native framework.

The framework was introduced to address the challenges faced by traditional Java applications in cloud-native environments. While Java is known for its robustness and scalability, it has often been criticized for its high memory consumption and slow startup times.

Quarkus seeks to overcome these limitations and provide a more efficient platform for building cloud-native applications.

Key features and characteristics of Quarkus include:

  1. Supersonic Subatomic Java: Quarkus claims to provide supersonic speed and a subatomic memory footprint. It achieves this by using a technique called “GraalVM Native Image” to compile Java applications into native executables, which result in faster startup times and reduced memory usage.
  2. Microprofile and Jakarta EE Compatible: Quarkus is compatible with popular Java standards, including MicroProfile and Jakarta EE. This means developers can leverage existing libraries while building applications on Quarkus.
  3. Cloud-Native and Kubernetes-First: Quarkus is designed from the ground up to work well in cloud-native environments and is optimized for deployment on Kubernetes. It offers native integrations with Kubernetes features like ConfigMaps and Secrets.

Code

A sample API written in Quarkus project is given below.

package com.example;

import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.ArrayList;
import java.util.List;

@Path("/books")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public class BookResource {

    private List<Book> books = new ArrayList<>();

    @GET
    public Response getAllBooks() {
        return Response.ok(books).build();
    }
  
}

Notice that we are only adding Java libraries here to create APIs.

Personally, I found it more challenging to get the setup ready in my local machine to run the Quarkus app compared to how I usually go to spring initlzr, add dependencies, and get my app up and running in literally no time.

But that could also be because I have spent years playing around with Spring-based projects, and the community support out there for Spring projects is much higher than the comparatively-new Quarkus project.

Anyways, do try this project and form your own opinion.

Happy coding!

Java
Spring Boot
Technology
Programming
Spring
Recommended from ReadMedium