This article is more than 1 year old

Onwards to Valhalla: Java ain't dead yet and it's only getting bigger

That is, if the sheer amount biz uses is anything to go by

Scale was big at the JavaOne conference this week. Spotify lauded its success scaling with Java, and Oracle execs practically squealed as they reeled off adoption statistics. Big Red believes the next ten years belong to Java.

"We want the next decade to be Java first, Java always," vice president Mark Cavage said on stage.

Of course Java is already big and among those on stage was Alibaba, one of the world's largest Java users, which talked up its ability to run more than a million JVM instances at once.

Alibaba was a nominee for the Java Community Process (JCP) executive committee last year, but didn't make the cut. Its goal has been to push through changes to Java that would help it to improve performance on hyperscale web platforms like its own.

The Chinese giant has long been interested in tweaking technical areas like garbage collection and compilation to create a "big Java" ready for colossal deployments, and it uses a heavily customised Alibaba JVM, or AJVM, (PDF) that runs multiple applications alongside each other.

Alibaba didn't answer our questions by press time, but David Blevins, founder of Tomitribe who did make it onto the Executive Committee this year, has some thoughts about the firm's approach.

"It's all based around OSGIs built down into the JVM, and in that way it's parallel with Java 9 and its move to modularity," Blevins said. "There's definitely some synergy that could happen on that side of the fence."

Having said that, he described the AJVM as the textbook definition of a monolithic architecture in western terms thanks to its multi-tenanted implementation. "Where things disconnect is having multiple applications running inside a JVM. It's definitely not the trend in the US and Europe."

Go big or go home

Instead, Java implementations in the west are moving in opposite, scale-out direction based on containers and micro services. The idea is to run lots of very small, single-service JVMs in a "server as cattle" configuration, and we could see that on stage at the show, as representatives from Google talked about using Java with Kubernetes, while Oracle debuted its Fn container platform.

The direction might be big-scale, but the underpinnings are small – large applications and services built using a modular architecture. And perhaps the biggest addition to Java 9 that helps promote a cloud-friendly scale-out approach in this way is Project Jigsaw. Oracle's Java Platform Group chief architect Mark Reinhold this week described Jigsaw as a nine-year-old project to make the JDK less monolithic.

It also represents a cultural change that had the Java community buzzing in advance of its release.

Jigsaw breaks one of Java's long-established rules, which forbade subsetting. Developers have always been told to ship the entire platform, including a lot of things that their applications didn't need. That makes it more difficult to run JVMs as efficiently as possible in cloud-based infrastructures, explained Mike Milinkovich, executive director of the Eclipse Foundation.

Eclipse is the new home of Enterprise Edition Java (once Java EE, now EE4J).

"There's still a limit on how many of these you could run on a single piece of physical hardware, because each one of those operating system VMs will have all the memory requirements of a full running Java server," he said. "So it's harder to make all of these work in cloud infrastructures relative to other runtimes."

Some pain, some gains

Jigsaw changes that by breaking things up into modules – a set of reusable packages that can be used within a JVM. This stops a JVM having to drag along every package in the JDK when it wants to operate. It divides Java SE into a set of standard modules that can be packaged as independent collections into a JVM.

In practice, this means you don't have to include things you don't need in JVMs running microservices. For example, you don't need to include bloat such as a CORBA object request broker, which is something that takes up space and which the majority of web application architects will never need.

You can configure a JVM that only needs java.sql and the modules it depends on, and cut out everything else. You can also automatically create those runtimes using a new command called jlink that pulls everything together for you.

The downside? Jigsaw may mean some code refactoring, especially for applications that use APIs deprecated in Java 8, or those that use JDK internals. As Reinhold told JavaOne: Jigsaw breaks some things. So there may be some library and framework fixing. Some pain, then, but also some welcome gain.

There are other enhancements in Java 9 that could benefit those running Java in larger, scale-out environments.

In addition to sharing classes between JVMs, you can also share strings. If you're using several instances of the same service to support a workload, they don't each need their own copies.

More about


Send us news

Other stories you might like