Blog

Home / Blog

Oracle Helidon 4 Java Microservices Framework stresses Virtual Threads

Jason Li
Sr. Software Development Engineer
Skilled Angular and .NET developer, team leader for a healthcare insurance company.
December 08, 2023


Introduction: Helidon

Helidon, the cloud-native, open-source set of Java libraries, is lightweight, fast, and crafted just for Microservices. With Helidon, Microservices can run on a fast web core, which gets powered by Java virtual threads. Recently Helidon 4.0.0 got released that modernized the Microservices with virtual threads. Oracle Helidon 4 helps to write and design Microservices in simple and fast steps. The Helidon got designed to be simple to use through various tools and examples and one can design Microservices quickly with virtual threads of Helidon. Currently, Helidon Web-Server is the world’s fastest web server written from scratch, which is fully based on virtual threads. The Helidon provides ample support to Micro-Profile. It provides familiar Application Programming Interfaces (APIs) like JAX-RS, CDI, and JSON-P/B with its implementation running on the Helidon Web-Server. 

The Helidon Web-Server provides a modern functional programming model. It runs on virtual threads. These are lightweight and flexible as aforementioned. The Helidon Web-Server provides a simple-to-use and fast foundation for the Microservices that get designed with the Helidon. It is observable and resilient with support for metrics, health checks, telemetry, and fault tolerance. Helidon gets used to writing cloud-ready applications, which integrate with Prometheus, Opentelemetry, Jaeger/Zipkin, and Kubernetes. It supports GraalVM Native Image so that one can compile the Helidon applications into a small-footprint native executable. Helidon gets used to package the application as a Jlink image or a traditional application JAR. Also, Helidon persistently supports DB connectivity. Its database clients support the existing JDBC drivers and its relational and non-relational databases.  

Helidon is natively awesome with features that make a difference in designing Microservices using virtual threads. Here, all the cloud-native features that are needed in a declarative programming model based on industry needs get provided by Helidon to those who design Microservices and their applications. As is known, Helidon is designed through a collection of Java libraries. It is an Open Source Software (OSS) under the Apache license with its source codes available on GitHub. Helidon is cloud-native and provides fast start-up time. It has low memory consumption with a small disk footprint. The Helidon gets loaded with tools for observation that include metrics, tracing, and logging as mentioned before. Helidon is packaged and available in two flavors, which are Helidon SE and Helidon MP. One can use Helidon SE if performance is the main goal with no plans of using any CDI-based components. 

Here, the Microservices application is heavily using concurrency. The Helidon MP can be used if one's application is based on modern enterprise Java standards like Jakarta EE and Micro-Profile. If CDI-based components are needed for the application, Helidon MP is the right OSS to be used along with JPA for data access and Jersey (JAX-RS) for RESTful services. One should be familiar with Jakarta EE, Java EE, or Spring Boot and have similar development experience to use Helidon MP. 

The prerequisites for Helidon include Java and Maven. The developers might also need to consider using Docker and Kubernetes based on how they plan to deploy the Microservices. Here, the prerequisite product versions for Helidon 4.0.0 include Java SE 21, Java21+, Open JDK 21, Maven 3.8+, Docker 18.09+, and Kubectl 1.16.5+ for deploying to Kubernetes along with a Kubernetes cluster, which can be installed on a desktop. 

Installation of Helidon CLI (Command Line Interface) is strongly recommended as it helps in designing, generating, and building Helidon projects. With the launch of Helidon 4.0.0., a new Helidon Web-Server named Project Níma got introduced. It is a virtual threads-based Web-Server implementation, which is in turn based on JDK Project Loom virtual threads. 

Helidon 4 removed the Helidon Reactive Web-Server and Web-Client based on Netty. Currently, the new implementations got based on virtual threads. These have a blocking style API as per Project Níma. The new version, Helidon 4.0.0 got launched by converting other reactive API modules to blocking-style APIs. Here, the io.helidon.common.reactive APIs stay as general-purpose reactive utilities and operators as per Helidon SE. The upgraded Micro-Profile support to Micro-Profile 6 and Jakarta 10 Core Profile running on the Helidon Web-Server got implemented as per Helidon MP. As mentioned before, Java 21 and Java 21+ are required to use Helidon 4. 

Helidon 4 Web-Server

Before the launch of Helidon 4, the earlier versions of Helidon Web-Server were built on Netty with a reactive Application Programming Interface (API). The Helidon 4 got built with a new Web-Server implementation named Project Níma. It is written from the ground-up to incorporate the benefits of Java 21 virtual threads. Here, the virtual threads are not a scarce resource to be carefully pooled and managed. The virtual threads are available in abundance and can be created as needed to handle unlimited concurrent requests. As each request runs in its own dedicated thread, it becomes free to perform blocking operations, like calling a database or any other service. The operations can be done in simple synchronous ways. One need not fear of blocking a platform thread and starving other requests. 

Helidon SE

The Helidon SE forms the foundational set of APIs for Helidon. With Helidon 4, a big change that came forth is the use of virtual threads. It has enabled the APIs to change from asynchronous to blocking. Thus, it results in the generation of much simpler codes that are easier to write, edit, modify, maintain, debug, and understand. The previous Helidon 3.0.0 SE Codes need to undergo the required modifications to run on these new APIs. However, the effort is well worth it with much improved performance and simplicity of the resulting codes. 

Helidon MP

The Micro-Profile implementation of Helidon gets known as the Helidon MP. The Helidon 4 supports Micro-Profile 6 and the Jakarta EE 10 Core Profile. The previous version, the Helidon 3 Micro-Profile application needs to be migrated to Helidon 4 as the Micro-Profile server of Helidon is now based on the new Helidon Web-Server as per Project Níma. The developers get all the benefits of running on virtual threads. 

Helidon CLI (Command Line Interface)

The Helidon CLI provides a convenient way to bootstrap all Helidon applications as mentioned before. Thus, it allows the developers to choose from a set of archetypes. These are pre-defined feature sets that let the developers to customize Microservices through Helidon by providing a host of options. Helidon provides a list or set of archetypes to bootstrap the app development. 

QuickStart 

The QuickStart option helps create a Helidon project with multiple REST operations. It includes a default observe-ability setup with a set of dependencies that enable the ease of development. 

Database

The Database option gets built on QuickStart to integrate with a database. Here, Helidon SE uses the DbClient API and Helidon MP uses JPA. 

OCI

The OCI option gets built on QuickStart and it demonstrates integration with Oracle Infrastructure (OCI) services that use OCI SDK. 

Custom

The Custom option enables users and developers to create customized Helidon projects, which are suitable to start from scratch. 

Oracle Helidon 4

On October 24, 2023, version 4 of Helidon got announced by Oracle before releasing its production version. Helidon 4 is a Microservices framework for Java that features a server implementation. It harnesses virtual threads to enable high performance. As mentioned, before Helidon 4, the web-server of the project utilized Netty as its foundation while using a Reactive API. 

The new version of Helidon or release 4 introduces a new server that is designed to harness the capabilities of Java 21 virtual threads. The new server is called Níma, and it is intended to reduce the efforts needed to write and maintain the high-throughput concurrent applications. Helidon 4 uses virtual threads, which is a shift from managing threads as a limited resource to considering them as in abundance. With Helidon 4, Helidon MP now supports the Eclipse Micro-Profile 6.0 enterprise Java Microservices architecture. To use Helidon 4, the developers need to use Java 21 or newer. The Open Source Software includes a set of cloud-native Java libraries. These help to create and write Microservices that run a fast web core, which is powered by Java virtual threads. 

Oracle Helidon uses Java Virtual Threads to improve performance

As aforementioned, the version 4.0.0 of Java Microservices by Oracle known as Helidon introduces a web-server based on virtual threads. As per Oracle, it promises an outstanding performance with a simple programming. The Helidon 4 is currently in an alpha or advanced state of development. The web-server named, Níma, consists of JVM-managed lightweight threads that improve the overall scalability of Microservices. The developers can access the Helidon 4.0.0 alpha release through GitHub. The instructions on getting started with Helidon can be accessed from helidon.io. Here, Níma supports Micro-Profile 5.0 and replaces the Netty NIO client-server framework. 

Conclusion

Oracle Helidon 4 Java Microservices framework stresses virtual threads through its new web-server named Níma. Helidon SE and Helidon MP can work as two distinct flavors, which gets used by developers to scale-up the Microservices applications and architecture.