BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News End of Year Learnings from Minecraft’s Migration to JDK 16 and Q&A with the Mojang Team

End of Year Learnings from Minecraft’s Migration to JDK 16 and Q&A with the Mojang Team

This item in japanese

Lire ce contenu en français

With the year quickly coming to an end, whether we like it or not, we reflect on 2021. Probably one of the things worth mentioning, especially in the Java world, is the release of JDK 17, the LTS version incorporating features like pattern matching for switches, a new vector API or sealed classes. The release bears the promise of out-of-the-box improved performance, 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 team at Minecraft decided to make the move earlier, migrating to JDK 16. This is even more interesting, as Minecraft is now part of Microsoft, hence it will use the newly developed JRE. Given their head start with running Java 16 in production, InfoQ spoke to the Mojang team to better understand their experience and gains.

InfoQ: What was the reasoning for migrating to Java 16, when Java 17 was just around the corner? Did you migrate to Java 17, or do you intend to? What was the version you migrated from?

Mojang team:

We’d been keeping up-to-date with each Java release version as it came out (on a separate branch from our main branch). Java 16 gave us significant out-of-the-box performance gains with regards to startup times, memory management and code execution. It also gave our developers a boost in their productivity with new features like var, switch expressions, text blocks and more!

We’re currently evaluating Java 17 with Microsoft, since it is an LTS release it makes sense that we’ll roll it out sometime in the future, but we’re not committing to a concrete date yet.

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

Mojang team:

As we’d been keeping up-to-date with each major version, we avoided the big bang migration and so it wasn’t too difficult. The earlier challenges in the migration came via moving from Java 8 to Java 11 due to the module system introducing stricter security controls around accessing JDK internals which some of our 3rd party dependencies relied on at the time.

We recommend that any serious Java shop sets up their CI/CD to onboard each major release. Then you can incrementally update your dependencies and code to take advantage of the new features. Once you get into the habit it’s a relatively small update cost for a large gain each time!

InfoQ: You have been running JDK 16 in production for some time now. What improvements did you observe in comparison with the previous setup?

Mojang team:

Lots of performance gains out-of-the-box with start-up times from Application and Class Data Sharing, memory efficiency gains from String Deduplication in the G1 Garbage Collector, a smoother experience because there are fewer long pauses from GC, and a host of other small improvements. It’s worth upgrading from an operational perspective!

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

Mojang team:

We didn’t have any failed expectations per se; it’s been very successful. One interesting thing was that we weren’t sure how quickly the mod community would take to using the new language features. The response has been overwhelmingly positive; it really matters to their developer productivity to have access to the latest features!

InfoQ: What Java build are you using? Is it the Microsoft one? If so, what was the inspiration to use it?

Mojang team:

It is the Microsoft Build of OpenJDK. Microsoft has made major long-term investments into Java (such as the jClarity acquisition in 2019). They have a very capable Java Engineering Group who have 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 challenging technical problems to tackle during the migration?

Mojang team:

There were three main challenges:

  1. One was just making sure we updated all the 3rd party dependencies to versions that also support Java 16 such as the Lightweight Java Gaming Library (LWGL).
  2. Making sure that changes in UI toolkits, fonts, sound etc. were still compatible.
  3. Re-configuring the new Garbage Collectors and other JVM tuning parameters to get the most out of the new changes.

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

Mojang team:

There were several guides and blog posts out there, but not really a canonical source for migrating through each version. It wasn’t a blocker, but we did have to piece the information together a bit. The Microsoft guide for transitioning from Java 8 to 11 was helpful.

InfoQ: What do you have planned next?

Mojang team:

From a purely Java perspective we’ll continue working with the Microsoft Java Engineering Group on testing each new Java version as they’re released. We’ll undoubtedly take some of those on once we’re satisfied with the stability, performance gains and developer productivity gains!

We can’t comment on any specific roadmap at this time but with Microsoft supporting the proposed two-year LTS cadence for OpenJDK vendors, it gives us the confidence that we can follow upgrades with a more regular cadence than we have in the past.

Even though for most of the companies the LTS releases are targeted when upgrading, Minecraft, now a Microsoft Company, took a leap of faith when upgrading to Java 16. Their expectations in terms of performance improve with start-up times out-of-the-box due to AppCDS, memory efficiency gains from String Deduplication in the G1 Garbage Collector, and an altogether smoother experience due to fewer long pauses from GC.

Also, the new language additions were welcomed by the mod community: "The response has been overwhelmingly positive, it really matters to their developer productivity to have access to the latest features!" These promise to allow developers to write more elegant code, faster.

Rate this Article

Adoption
Style

BT