Leyden: The new OpenJDK project
Published June 10, 2022
Project Leyden, launched in May 2022, aims to improve the startup time of Java applications, time to peak performance, and resource consumption by utilizing static runtime images.
The concept of static images and project goals
A static image is a standalone program that runs only an application it is derived from. Static images work under the closed-world assumption, i.e., they cannot load classes outside an image or generate new bytecode at runtime. These features enable the compilation of Java code to native executables, which is similar to GraalVM functionality.
Although static images are not a one-size-fits-all solution, they are highly beneficial for cloud deployment:
- Minimized startup and execution times can lower the cost of cold starts
- Small images decrease cloud resources consumption
Static images will be added to the Java Platform Specification. It is expected that GraalVM will implement this specification too. This way, developers will be able to shift from Leyden to native images or any other conforming implementation to reach the startup or footprint indicators fitting their project perfectly.
Project Leyden will be based on the following JDK components:
- HotSpot JVM
- Application class-data sharing (AppCDS)
Native images are a useful technology for startup and footprint minimization. For instance, Liberica Native Image Kit (NIK), a GraalVM-based tool, helps to accelerate the startup up to 1/10 s. So while Project Leyden is in the makings, experiment with native images and see for yourself that they are a game-changer in Java!
Project Leyden: gradual introduction
Mark Reinhold, chief architect of the Java Platform Group at Oracle, states that the project working group will take a step-by-step approach in terms of introducing a closed-world constraint to the Java platform. The group will start with analyzing various constraints, weaker than the close-world-constraint but suitable for a wider range of applications. The long-term goal is to adopt the complete close-world constraint so that developers can produce fully-static images.
Project Leyden currently has no repositories as it is at the conceptual stage of development. The repositories with documentation and code will be added gradually as the work on the project progresses, and the project itself will be introduced in a series of JEPs.