Menu
Project Leyden addresses Java pain points

Project Leyden addresses Java pain points

Leyden would mitigate Java’s large footprint and long-standing performance issues by introducing static images to the platform

Credit: Dreamstime

Long-term Java pain points including slow startup time, slow time to peak performance, and large footprint would be addressed by a proposal being floated in the OpenJDK community by Mark Reinhold, chief architect of Oracle’s Java platform group.

Called Project Leyden, the proposal would deal with these pain points by introducing the concept of static images to the Java platform and the JDK.

A static image is a standalone program, derived from an application that runs that application, and no other. A static image is also a “closed world” that cannot load classes from outside the image or spin new bytecodes at runtime.

These two constraints enable build-time analyses that can remove unused classes and identify initialisers that can be run at build time, thus reducing both the size of the runtime image and its startup time. These constraints also enable aggressive ahead-of-time compilation, thereby reducing the image’s time to peak performance.

Reinhold cautioned, though, that static images are not everyone, due to the closed-world constraint, nor are they for every type of application. Often, static images require manual configuration to achieve the best results.

“We do, however, expect the results to be worthwhile in important deployment scenarios, such as small, embedded devices and the cloud,” Reinhold wrote.

Taking inspiration from past efforts to explore the space, including the GNU Compiler for Java and the Native Image for GraalVM, Project Leyden would add static images to the Java Platform Specification. It is expected that GraalVM will evolve to implement that specification.

Developers using only the standard, specific static-image feature would then be able to switch easily between Leyden in the JDK, Native Image in GraalVM, and other conforming implementations that may arise. They can choose among tradeoffs of compile time, startup time, and image size.

Reinhold, who would lead the project, advised that there was no intent to implement Leyden by merging Native Image code from GraalVM into the JDK. Rather, Leyden would be based upon existing components in the JDK such as HotSpot JVM, the Java ahead-of-time compiler (jaotc), application-class data sharing, and the jlink linking tool.

Reinhold launched discussion of the project on April 27. Initial feedback on the project expressed on an OpenJDK mailing list was mixed, with one person suggesting it would be difficult to add static images to the Java Platform Specification, while also remarking that the project was interesting and welcome.

Another person said he was happy to see the proposal, because the time required to optimise performance and memory footprint has been the primary user complaint when using Java for microservices. Another commenter said it seems like the right time for such a project.

Project Leyden would begin with a clone of the current JDK mainline release, JDK 15, and track mainline releases moving forward. Leyden would be delivered via a series of JEPs (JDK Enhancement Proposals) that would likely span multiple releases.


Tags Oraclejava

Brand Post

Show Comments