Imagine a bacon-wrapped Ferrari. Still not better than our free technical reports.

The Past, Present and Future of the JVM: Memories from JavaOne 2013

During JavaONE 2013 I had the chance to visit a lot of different sessions (as this was my first year without any booth duties!) and one of them was Looking into the JVM Crystal Ball by Mikael Vidstedt, a JVM Architect from Oracle. It covered the past, present and the future of the JVM. I really enjoyed the talk and I think that the information from there might serve a larger audience.

Past and Present

One of the big things that was decided years ago (after the Oracle acquisition of Sun Microsystems) was the JVM convergence (mentioned even in a press release in 2010). So that instead of maintaining the large number of JVMs there would be one instead. So HotSpot, JRockit and CDC (embedded) would be the same JVM! It would be built on HotSpot and some features would be cherry picked from JRockit.

Mikael said that already a year ago (that is 2012) the mental thinking was that most of it was done! Then started the year of Java and security issues. Some features that were already planned for 7u8 got a push back because security fixes got precedence. And internally they had to bump the target JDK release version so many times (to accomodate the security releases) that at the end they gave up on using even an internal version number. Finally the goodies made it into JDK 7u40 (quite a jump from planned u8)!

Java Flight Recorder – a event based tracer and profiler built in. It collects JDK level events and stores them in a cycling buffer (cycling meaning that basically overwriting the old data when runs out of buffer space). It is intended for production environments and has advertised 2-3% overhead only!

Java Mission Control – this is an advanced, unobtrusive Java monitoring and management tool. It has detailed Java heap, GC, hot methods and other information. Again you can use it in production because of the extremely low overhead. You will be using the same tool to visualise data from the Java Flight Recorder.

Another surprise about these dtools are the platform they are built on. Can you spot it from the screenshot? Another wow from me :)

Java Mission Control

Miscellaneous updates in JDK7u40

  • Major overhaul of invokedynamic implementation (JSR292)
    • From hard to {implement, port, maintain} assembly code to a mostly .java implementation
    • Still needs performance work
  • G1 garbage collector improvements
  • Tune default GC settings based on feedback (JDK-8001425)
  • Humongous allocations prevent mixed GCs (JDK-8020155)
  • String table performance (think: String.intern())
  • Bumped to 60013 entries on 64-bit systems (was: 1009 entries) – Short term workaround – goal is to make size dynamic
  • 300+ bug fixes in HotSpot alone

Just wow I would say. I did know about the Java Mission Control but I didn’t know that it is safe and advertised for production and the same for Flight Recorder!

Plans for Java 8

Permgen disappearing was no news to me, but the compiler convergence was. Basically the current interpreter, client compiler (C1) and server compiler (C2) will turn into a tiered compiler.

Currently it starts with interpreting to collect information and start optimizing based on if C1 or C2 is used. In tiered mode, C1 will actually be used to collect information for C2 optimizations. This will mean faster startup times!

Also there will be a series of optimizations of common data types (Class, method structures etc.). When he was presenting the calculations how these add up, he also mentioned that projects with 50k classes and 1 million methods are not rare. Wow (again!)

The future and beyond

Security will stay as the focus area. Another will be cloud (cloud cloud cloud…). Here the use cases he presented were thousands of JVMs running the same application. Can you imagine the optimizations and how resource management should be done, while keeping high availability and isolation requirements? Also what do you do when more/less resources become available dynamically?

Another direction will be ergonomics. Right now, if you run the JVM in production you might have to add a ton of flags. The aim here would be making the JVM smarter by being good enough out of the box. The best JVM options are no JVM options :)

He mentioned a lot of more directions but I’ll only mentioned the ones that I caught my attention:

  • Nashorn – the new JavaScript implementation shipped with JDK8
  • Huge heaps (40GB and beyond)
  • Streamline Java for small devices
  • Project Sumatra – enable Java on GPUs
  • Compile and warm-up time
  • Deprecate
    • Concurrent Mark & Sweep GC strategy and move to G1
    • j* commands over time (jstack, jinfo, jmap, …) and use JCMD instead
    • JConsole and move functionality to Java Mission Control/VisualVM
    • HPROF agent
  • Big heaps, low & consistent pause times – Without requiring excessive tuning

I learned quite a lot from this presentation, which was definitely one of the most interesting I watched. This presentation was a great start to the conference, and I really enjoyed hearing not only about Java’s improvements, but how much more cool stuff is coming! Share your thoughts below in the comments section, or tweet @toomasr to get a hold of me.