Under the umbrella of Project Helidon, Oracle introduced a new microservices framework based on virtual threads (JEP 425) called Helidon Níma. It is built from the ground up to achieve an easy-to-use programming model with outstanding performance. The technology preview is now available with the Helidon 4.0.0-ALPHA1 release for those who are interested in evaluating the latest Java technology. However, this is not yet production-ready.
Developers could achieve a certain level of throughput using the regular Helidon framework through Helidon MP or Helidon SE, but if the application needs to be more performant, their only choice is to revert to a reactive-based service. However, it is worth mentioning that writing, maintaining, and debugging reactive-based services is more challenging.
Helidon Níma uses virtual threads to carve out the issue, as blocking is cheap, and we can create millions of them. Thus, this offers a stellar, low-overhead, highly concurrent server while maintaining a blocking thread model. This will allow developers to write simple, debuggable, and maintainable code with less scaffolding. Consider the following example:
Blocking Code | Reactive Code |
|
|
Both blocking and reactive code accomplish the same goal; however, the reactive code is more cognitively demanding, has a steeper learning curve, and is less maintainable. This becomes more apparent with a slightly more complicated use case, as stated in the initial blog post written by Tomas Langer, architect at Oracle.
According to Langer, the primary focus of Heldion Níma was performance; therefore, it does produce results, as the following graph demonstrates.
This alpha release supports the following protocols:
- HTTP/1.1 with pipelining — server and client
- HTTP/2 server (prototype, known issues)
- gRPC server (prototype, known issues)
- WebSocket server (prototype)
Besides that, it supports the following features:
- Tracing — using existing Helidon tracing implementations, such as Jaeger or Zipkin
- Static content — from classpath or file system
- Cross-Origin Resource Sharing (CORS)
- Access Log
- Observability endpoints (health, application information, config)
- Fault Tolerance (Bulkhead, Circuit Breaker, Retry, and Timeout features)
- HTTP/1.1 client
- Testing
On top of these features, it also uses new Java language features like sealed classes and enhanced switch expressions.
Helidon Níma is a fully open-source framework and part of the Helidon codebase. Although the project Helidon is based on Netty, however, Dmitry Aleksandrov, software developer at Oracle, mentioned in his blog post writing:
The Helidon Níma web server intends to replace Netty in the Helidon ecosystem. It also can be used by other frameworks as an embedded web server component.
Developers who wish to evaluate Helidion Níma can leverage Tomas Langer's initial blog post and the source code hosted on this GitHub repository.