Application Performance Management Support for Java 9

Instana is First Major APM Provider to Support Monitoring Java 9 Applications

Highlights of Java 9 Release

Officially released last week, Java 9 is making some developers giddy and others quite nervous. New features of Java 9 include significant Java features and improvements, including:

  • Application Modularity
    A new kind of Java programing component, the module, which is a named, self-describing collection of code and data. Modules create boundaries to isolate running code to improve compatibility, security and memory isolation. This also enables reduction of memory footprint of a running Java application and JVM, quite interesting to the microservice/container crowd.
  • Developer Convenience
    Adds Read-Eval-Print Loop (REPL) functionality to the Java platform.
  • Strings
    Adopts a more space-efficient internal representation for strings. Previously, the String class stored characters in a char array, using two bytes (16 bits) for each character. The new internal representation of the String class is a byte array plus an encoding-flag field.
  • Diagnostics
    Additional diagnostic commands.
  • JVM Options
    Validation of command line arguments.
  • Logging
    Defines a minimal logging API that platform classes can use to log messages, together with a service interface for consumers of those messages.
  • Javadoc
    Simplified API; HTML5 support; Search.
  • JavaScript/HTTP
    Parser API for Nashorn; ECMAScript 6.
  • Native Platform
    Improves the API for controlling and managing operating system processes.
  • JavaFX
    GTK 3 on Linux. Public APIs for those that are now inaccessible due to modularization.
  • Images
    Enables a set of images with different resolutions to be encapsulated into a single multiresolution image. Adds Tag Image File Format (TIFF) reading and writing.
  • Unicode
    Unicode 8.0. Loads properties files in UTF-8 encoding.

Java 9 is Perfect for Containerized Microservices

Many of these updates, especially application modularity, are specifically designed to make any specific JVM (and, of course, the application running inside it) more secure, more compatible and more efficient (with regards to memory usage). All of these enhancements make Java 9 a much better choice as a platform to develop and deploy in containerized microservice environments.

What is Java 9 Modularity?

For Application Performance Management users, the biggest Java 9 change is modularity. Before Java 9, any code running within a JVM has access to anything else running in the same JVM – with no boundaries. Modules create boundaries that isolate running code to improve compatibility, security and memory isolation.

A huge benefit of this is the the reduction of the overall memory footprint, making Java 9 much more suitable to develop and deploy for microservices. Within that vein, modularity allows the JAVA runtime to be fine-tuned by only including the functionality required by the application it is running. A good example would be the swing and awt graphical UI components, unlikely to be needed in a microservice. It is now possible to exclude these from a microservice’s runtime, making the overall package smaller.

Java 9 HTTP/2 Benefits

Another significant Java 9 feature is HTTP/2 support, which enhances the client API by including support for asynchronous HTTP calling.

CompletableFuture<HttpResponse> httpResponse =
	httpClient.sendAsync(httpRequest,
	HttpResponse.BodyHandler.asString());
/* do other stuff */
if (httpResponse.isDone()) {
	String data = httpResponse.get().body();
/* process data */
}

The original HTTP connection API was based on the HTTP/1.1 specification (dating all the way back to 1997). In the 20 years since, how we use the internet has changed enormously – and the HTTP specification has been improved to deal with the change. But the JAVA HTTP Handling API had fallen behind these changes. With the new API, there are now easy ways to create HTTP connections that are faster and easier to maintain, enabling responsive applications without requiring external libraries. Given the highly distributed nature of microservices, and that HTTP is commonly used for the transport between those services, the native support of HTTP/2 makes building modern microservice applications much easier for developers.

APM Repercussions of Java 9

While the new features in Java 9 provide many improvements in performance and efficiency for developers, there are serious repercussions in performance management, especially for traditional APM vendors.

Modularity Breaks Traditional APM Instrumentation

The introduction of modularity has changed the way Java’s built-in instrumentation and reflection APIs work — both of which are at the functional core of most Java monitoring agents.

The changes to the application instrumentation APIs requires a substantial reworking of agent code for monitoring solution providers. Some won’t even be able to deploy their monitoring agents. Fortunately, Instana does not rely on these old techniques.

Instana’s Java Monitoring approach has allowed us to provide Java 9 Application Monitoring from the start. So as of today, we are the first APM solution that is Java 9 Ready.

Correctly Monitoring Asynchronous Application Performance

Asynchronous applications have always been difficult for APM tools to monitor, given the typical agent’s need to “complete a request” to get a measurement. Various tools created their own concepts for long transactions that they can’t measure – essentially lumping them into a “potentially hung” bucket. Referring to an outstanding asynchronous request as stalled, delayed or hung is of no help because you end up with no measurement and false alarms.

Built from the beginning to support microservice-based applications, Instana’s APM monitoring includes full support for asynchronous requests (whether created by HTTP/2 or programmed into the code, itself). The result is complete and correct traces for all requests no matter how they’re implemented along with automatic monitoring of service performance.

Instana continues to lead the way building a modern APM for modern applications; dynamic applications, microservices applications, containerized applications, asynchronous applications, and Java 9 applications. We’ll be showcasing our modern APM capabilities at JavaOne next week, so drop by the booth, get a Stan Squeeze ball and see a demo for yourself.