Quarkus and Instana: Lightspeed Monitoring for Supersonic Java

Quarkus Monitoring Featured Image

This blog post was co-authored by Christoph Engelbert and Tim Riemer.

Guest Author Tim Riemer Tim Riemer works as Senior Solution Architect at Vorwerk Group and has over 20 years of Java experience.
He is fascinated by the JVM, the languages available on it, and open source in general.
In addition to his job, he also deals with current topics around software architecture, Spring Boot, Build-Automation and Kotlin.
Tim is co-founder of the Kotlin User Group Dusseldorf, the first non-Java User Group in the iJUG e.V. umbrella organizations in Germany.

 

Once in awhile a new technology emerges to disrupt the industry. Sometimes it is a container technology, sometimes a ride platform or, like this time, a new microservices framework for the Java ecosystem. Quarkus, released in March of this year, not only provides a fast, intuitive API to build microservices, but also provides support for Oracle Labs’ GraalVM and, therefore, native builds.

Native executables written in Java are not really new though, Excelsior Jet provides the possibility to have native compilation to the Java ecosystem for years, however, Graal offers native builds for free.

Quark Us

Anyway, back to Quarkus. If by accident or on purpose, Quarks are the smallest particles in the universe, as your microservices are the smallest logical elements of your distributed system.

Quarkus strives to make Java the leading platform in the Kubernetes and serverless environments. To achieve that, it provides developers with a full-stack framework, offering a unified experience, with both reactive and imperative APIs.

On top, Quarkus, thanks to GraalVM support, delivers fast but small containers for quick deployment and boot times compared to standard Java applications with a more traditional cloud stack approach.


Comparison of size and speed Quarkus vs. traditional cloud stack
Figure 1: Comparison of size and speed Quarkus vs. traditional cloud stack, source: quarkus.io

Supersonic Java

With the focus on developer productivity, Quarkus offers a set of very cool features, such as unified configuration, no matter where you deploy. In the best case it runs without any configuration at all, bringing zero configuration to environments like Kubernetes.

Furthermore it tries to minimize the necessary code base for the most common cases, making it as easy as the following code snippets to write a REST service.

@Inject
SayService say;

@GET
@Produces(MediaType.TEXT_PLAIN)
public String hello() {
  return say.hello();
}

The biggest benefit, however, is the support of generating native images using GraalVM’s ahead-of-time compiler, which is completely integrated into Quarkus’ build process.

Native image means that the Java program is compiled down to a fully self-sustaining native executable. For execution, no Java Runtime environment is required to be installed on the machine. All required components are compiled straight into the executable, leaving out unnecessary parts of the runtime to minimize size. In this sense it’s very similar to how Go executables are designed.

All the efficiency, productivity and speed benefits delivered through Quarkus are combined into the slogan “Supersonic Java”; bring Java based services to the next level of velocity without any hassle in the process.

Lightspeed Monitoring

When writing production services or applications though, developers need monitoring to gather insight into their work – delivering not only basic metrics but full distributed tracing throughout the infrastructure and request flow.

With Quarkus running on the standard Java platform, Instana can use its AutoTrace technology to dynamically instrument the application and add tracings and metrics on-the-fly. When being compiled into a native image though, dynamic instrumentation using a Java agent is not possible anymore.

That said, we need a different way to gather the necessary information. Quarkus to the rescue though, as it includes a built-in OpenTracing/Jaeger module and therefore does the important bits already.

Instana, with the Quarkus OpenTracing module, is able to capture traces right away. We only need to point the quarkus.opentracing.endpoint (or the JAEGER_ENDPOINT environment variable) to our Instana agent. A single setting (http://instana-agent:42699/com.instana.plugin.jaeger.trace) and we’re good to go with tracing of the native Quarkus service.

In addition, however, it is recommended to add the Instana Java OpenTracing artifact to your dependency build and initialize the tracer as mentioned in the README. This enables Instana to not only gather the traces, but also merge them with process metrics gathered on the operating system level and map the process into the infrastructure view.


Quarkus based service (waterservice), built as a native image with GraalVM integrated in an Instana trace
Figure 2: Quarkus based service (waterservice), built as a native image with GraalVM integrated in an Instana trace

The really cool thing is though, afterwards we get all the other nice metrics and benefits from Instana out of the box, right with it. We capture the error rates, average or min/max latencies; all the goodies we love about Instana.


Additional metrics about our Quarkus service
Figure 3: Additional metrics about our Quarkus service

Right to Ludicrous Speed

The power and existing knowledge of the Java platform that exists with a large group of developers, the speed and startup times of native compilation, and the insight gathered by Instana are an exceptional combination.

To try it out today, jump right into the Quarkus Getting Started guide and sign up for a 14-day free trial of Instana, if you don’t have a subscription yet.

And always remember, if Lightspeed is not fast enough, go right to Ludicrous Speed as a wise man once said. Oh and don’t forget to trust Mr. Coffee! 🙂

Play with Instana’s APM Observability Sandbox

Conceptual
It was 3:38 am and our smoke alarm blared loudly and proudly somewhere in our house. My husband and I jolted from bed and into emergency mode. I rushed into our son’s...
|
Conceptual, Customer Stories, Engineering
Halloween is a scary time to be in abandoned buildings, cemeteries, and dark forests… and DevOps teams. Developers, operations engineers, and SREs told us some DevOps horror stories that have haunted them...
|
Developer, Product, Thought Leadership
In my last blog post, I talked about the history and rapid adoption of the OpenTelemetry project. Today we discuss the progress made in terms of end-to-end compatibility between distributed tracing with...
|

Start your FREE TRIAL today!

Instana, an IBM company, provides an Enterprise Observability Platform with automated application monitoring capabilities to businesses operating complex, modern, cloud-native applications no matter where they reside – on-premises or in public and private clouds, including mobile devices or IBM Z.

Control hybrid modern applications with Instana’s AI-powered discovery of deep contextual dependencies inside hybrid applications. Instana also gives visibility into development pipelines to help enable closed-loop DevOps automation.

This provides actionable feedback needed for clients as they to optimize application performance, enable innovation and mitigate risk, helping Dev+Ops add value and efficiency to software delivery pipelines while meeting their service and business level objectives.

For further information, please visit instana.com.