BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Project Leyden Aims to Improve Java Startup Time

Project Leyden Aims to Improve Java Startup Time

This item in japanese

Lire ce contenu en français

Java Language Architect Mark Reinhold proposed the creation of a new OpenJDK project Leyden: static application binaries with faster startup and lower memory. Once approved and completed, this would enable developers to compile Java code (just-in-time) to native applications (ahead-of-time), offering capabilities similar to GraalVM's native mode.

The project has conceptual backing from Oracle through Reinhold, as well as RedHat. Following the project proposal, RedHat’s OpenJDK lead Andrew Haley chimed in, "this is excellent news. It's about time to bring static AOT compilation into the fold. Let's get it done!" Similar sentiment came from Amazon, with PaulHohensee stating, "very happy to see this proposal." RedHat is a member of the Java Community Process Executive Committee and Amazon is an influential community member that maintains a Java distribution, Amazon Corretto. Users of serverless frameworks like AWS Lambda and Azure Functions would stand to benefit from Leyden, as operators pay on time used -- the rapid startup and execution times could decrease the cost of cold starts and bring per-invocation charges closer to or below the minimum cost threshold.

Leyden and GraalVM would work across a similar chain that developers follow to write and build applications:

  1. Developers write custom source code that connects to and relies on APIs of selected libraries, typically in JAR files.

  2. Custom code is compiled into bytecode that is packaged in one or more JAR files based.

  3. Leyden would introduce a new split path fior how applications run:

    1. Applications could follow the traditional course to run the bytecode, optimizing the "hot spots" of the application to native machine code as the application runs.

    2. A new opportunity to compile the application against OS-specific libraries to make a native application that runs on a single operating system similar to other native compiler tools.

The project would build on and improve capabilities that are present in Java today, used by developers to distribute applications.

  • javapackager is used to distribute applications with an embedded and customized JRE for a single application. End users do not require a system-wide Java installation to run each application, as the application’s launch points go through its bundled java executable.
  • jaotc is an experimental compiler for some platforms that produces a native executable. Leyden may expand directly on top of jaotc.

The benefit of natively compiled applications is already prominently visible through RedHat’s application framework Quarkus: Supersonic Subatomic Java. Quarkus leverages GraalVM native image to produce applications that are "supersonic" in the time to first request or startup as a serverless function, and "subatomic" where the natively compiled application is smaller than the original Java bytecode. The Quarkus home page lists these metrics in a legible chart on its home page with boxes for a visual comparison:

  • In JDK mode, a CRUD app used 145MB RAM.
  • In Native mode, a CRUD app used 28MB RAM, approximately an 80% decrease.
  • In JDK mode, the CRUD app took 2.033 seconds to the first HTTP response.
  • In Native mode, the CRUD app took 0,042 seconds, approximately a 98% decrease.

No timeframe exists for Leyden’s completion, enabling the project to be feature-driven rather than date-driven. With Java’s six-month release cadence, evaluation candidates will appear in a release to establish an effective feedback cycle.

Rate this Article

Adoption
Style

BT