days
0
-27
-4
hours
-1
-5
minutes
-3
-9
seconds
-1
-5
search
Slow startup and large footprint will be a thing of the past

Project Leyden to bring static images to the Java platform and JDK

Chris Stewart
java

Chief Architect of the Java Platform Group at Oracle, Mark Reinhold, has written a call for discussion proposing a new project, Project Leyden, that will address the long-term pain points of Java’s slow startup time, slow time to peak performance, and large footprint. It will do this by introducing static images to the Java platform and JDK. Let’s take a closer look.

A call for discussion issued by Chief Architect of the Java Platform Group at Oracle, Mark Reinhold, lays out a proposal for a new project, Project Leyden, that will address the long-term pain points of Java’s slow startup time, slow time to peak performance, and large footprint by introducing static images to the Java platform and JDK.

Static images in Java

Reinhold describes a static image as “a standalone program, derived from an application, which runs that application — and no other”, and as “a closed world: It cannot load classes from outside the image, nor can it spin new bytecodes at run time.” Static images are not for everyone, but for relevant use cases these constraints allow for build-time analyses that remove unused classes and identify class initializers that can be run at build time, which reduces both the size of the image and its startup time. The constraints also permit aggressive ahead-of-time compilation, greatly reducing the image’s time to peak performance.

Static images often necessitate manual configuration to get the most out of them, but for small embedded devices or cloud-based applications such as microservices, such patience will be rewarded with much-improved performance.

SEE ALSO: Java 15 news updates

Project Leyden

The new project will take inspiration from past efforts such as the GNU Compiler for Java and GraalVM’s native image feature. Reinhold wrote, “Leyden will add static images to the Java Platform Specification, and we expect that GraalVM will evolve to implement that Specification. Developers who use only the standard, specified static-image feature will then be able to switch with ease between Leyden (in the JDK), Native Image (in GraalVM), and whatever other conforming implementations may arise, choosing amongst tradeoffs of compile time, startup time, and image size.”

On Twitter, Reinhold has expressed his enthusiasm about the GraalVM team contributing to Project Leyden.

The intention is not, however, to implement Leyden by merging GraalVM’s native image code into the JDK. Instead, Leyden will be built upon existing JDK components such as the HotSpot JVM, the jaotc AOT compiler, application class-data sharing, and the jlink linking tool.

SEE ALSO: JEP 376: ZGC – Concurrent Thread-Stack Processing

Since the proposal’s publication on Monday April 27th, the initial feedback has been quite positive, although some have brought up that it might be difficult to implement static images in the Java Platform Specification.

Project Leyden will be delivered as a series of JEPs that will span multiple Java versions.

Author
Chris Stewart
Chris Stewart is an Online Editor for JAXenter.com. He studied French at Somerville College, Oxford before moving to Germany in 2011. He speaks too many languages, writes a blog, and dabbles in card tricks.

Leave a Reply

avatar
400