End-of-year learning from Minecraft to JDK 16 and Q&A with the Mojang team

As the year draws to a close whether we like it or not, we reflect on 2021. One of the things that is probably worth mentioning, especially in the Java world, is the release of JDK 17. , the LTS version incorporating features such as the model. correspondence for switches, a new vector API, or sealed classes. The release promises improved performance out of the box, as Application and Class Data Sharing (AppCDS) is among the new features, along with the improved performance of the new G1 Garbage Collector. Even though the release date was clearly set, the Minecraft team decided to take the step earlier, migrating to JDK 16. It’s even more interesting, as Minecraft is now part of Microsoft, so it will use the JRE. newly developed. Given their head start in running Java 16 in production, InfoQ spoke with the Mojang team to better understand their experience and earnings.

InfoQ: What was the reason for migrating to Java 16 when Java 17 was just around the corner? Have you migrated to Java 17 or are you planning to do so? What version did you migrate from?

The Mojang team:

We kept abreast of each version of Java as it was released (on a separate branch from our main branch). Java 16 has given us turnkey performance gains in boot times, memory management, and code execution. It has also given our developers an increase in their productivity with new features such as var, switch expressions, text blocks and more!

We are currently evaluating Java 17 with Microsoft, since it is an LTS version, it makes sense that we deploy it in the future, but we do not commit to a concrete date yet.

InfoQ: Can you describe the migration process? How smooth was that? How long did the migration take?

The Mojang team:

As we kept abreast of every major release, we avoided the big bang migration so it wasn’t too difficult. The first migration challenges came with the move from Java 8 to Java 11 due to the module system introducing more stringent security controls regarding access to internal JDK components than some of our 3e party dependencies invoked at the time.

We recommend any serious Java store to configure its CI / CD to integrate each major version. Then you can update your dependencies and code incrementally to take advantage of the new features. Once you get used to it, it’s a relatively low cost to update for a big payout every time!

InfoQ: You have been using JDK 16 in production for some time now. What improvements have you observed compared to the previous configuration?

The Mojang team:

Many out-of-the-box performance gains with boot times from sharing application and class data, memory efficiency gains through string deduplication in Garbage Collector G1, experience smoother as there are fewer long GC pauses and a host of other small improvements. It is worth improving from an operational point of view!

InfoQ: Was there something you expected once using Java 16, but didn’t?

The Mojang team:

We did not have disappointed expectations per se, it was very successful. One interesting thing was that we weren’t sure how quickly the mod community would use the new language features. The response has been overwhelmingly positive, it is really important for the productivity of their developers to have access to the latest features!

InfoQ: What version of Java are you using? Is it Microsoft’s? If so, what was the inspiration for using it?

The Mojang team:

This is the Microsoft version of OpenJDK. Microsoft has made significant long-term investments in Java (such as the acquisition of jClarity in 2019). They have a very knowledgeable Java engineering group that has already made significant contributions to Java itself (like the Windows ARM port). They also share our love for Minecraft, we know we’re in good hands.

InfoQ: What were the most difficult technical issues to resolve during the migration?

The Mojang team:

There were three main challenges:

  1. One was just to make sure we update all 3e Part dependencies on versions that also support Java 16, such as the Java Lightweight Game Library (LWGL).
  2. Make sure that changes to UI toolboxes, fonts, sound, etc. are still compatible.
  3. Reconfigure the new Garbage Collectors and other JVM tuning parameters to make the most of the new changes.

InfoQ: What would you like to know before the migration, but you didn’t?

The Mojang team:

There were several guides and blog posts, but not really a canonical source to migrate through each version. It wasn’t a blocker, but we had to piece the information back together a bit. Microsoft’s guide to transitioning from Java 8 to 11 was helpful.

InfoQ: What do you plan next?

The Mojang team:

From a purely Java perspective, we will continue to work with the Microsoft Java Engineering Group to test each new version of Java as it is released. We will undoubtedly pick up some of them once we are satisfied with the stability, performance gains and productivity gains of the developers!

We can’t comment on any specific roadmaps at this time, but with Microsoft’s support for the two-year LTS cadence offered for OpenJDK vendors, it gives us confidence that we can keep up with upgrades with a more regular pace than in the past.

Even though for most companies LTS versions are targeted when upgrading, Minecraft, now a Microsoft company, took a leap of faith when upgrading to Java 16. Their expectations in terms of price gains. performance with start-up times out of the box thanks to AppCDS, memory efficiency gains thanks to string deduplication in the G1 garbage collector, and an entirely smoother experience thanks to fewer long GC pauses.

In addition, the new language additions were well received by the mod community: “The response has been overwhelmingly positive, it is really important for the productivity of their developers to have access to the latest features!”. These promise to allow developers to write sleeker code, faster.