paul_krill
Editor at Large

Project Leyden set to bring faster startups to Java

news
May 23, 20222 mins
JavaSoftware Development

Green-lit Project Leyden will work to mitigate slow startup and performance issues by introducing static images to the Java platform.

speed fast race car shutterstock 1168856884
Credit: Jamesboy Nuchaikong / Shutterstock

A simmering proposal to address Java pain points, including slow startup, slow time to peak performance, and large footprint, is now moving forward.

Project Leyden, under discussion for more than two years, will address these pain points by introducing static images to the JDK and the Java platform. In an OpenJDK post on May 20, Mark Reinhold, chief architect of the Java platform group at Oracle, decreed it was time for the project to begin.

A static image is a standalone program, derived from an application, that runs that application and no other. The static image serves as a closed world with respect to classes it can load. At runtime, it cannot load classes from outside the image, nor can it create classes dynamically. The closed-world constraint strictly limits Java’s natural dynamism, particularly on runtime reflection and class-loading features, on which many existing Java frameworks and libraries depend.

Not all applications are well-suited to this constraint and not all developers are willing to live with it, Reinhold said. Rather than adopt the closed-world constraint from the start, Reinhold proposed a gradual, incremental approach, exploring a spectrum of constraints. The resulting optimizations will likely be weaker than the closed-world constraint. But the optimizations should be applicable to a broader range of existing code.

In the long run, developers on the project will likely embrace the full closed-world constraint in order to produce fully static images. The effort will lean heavily on existing components of the JDK, including the HotSpot JVM, C2 compiler, application class-data sharing, and the jlink code tool.