alex_aldo - Fotolia
Oracle's Project Leyden uses static images to ease Java pain
Oracle's new Project Leyden introduces static images to help ease long-standing Java language shortcomings such as slow startup times and unwieldy footprints.
A new project from Oracle seeks to solve the nagging problem of slow Java startup times and other performance-related issues.
Dubbed Project Leyden, the effort will address these pain points by introducing a concept of "static images" to the Java Platform and the Java Development Kit (JDK), said Mark Reinhold, chief architect of the Java platform group at Oracle, in a post to a Java mailing list about the effort he proposed and heads up.
He describes a static image as "a standalone program, derived from an application, which runs that application -- and no other." Moreover, "a static image is a closed world: It cannot load classes from outside the image, nor can it spin new bytecodes at run time," Reinhold said.
These two constraints can reduce both the size of the image and its startup time. In addition, the constraints "enable aggressive ahead-of-time compilation, thereby reducing the image's time to peak performance," he said. Ahead-of-time compilation is the act of compiling a higher-level programming language such as C or C++ into a native machine code so that the resulting binary file can execute natively.
"This project will take inspiration from GraalVM's early-access 'Native Image' feature, but it's based on existing components of the JDK: HotSpot JVM, the 'jaotc' ahead-of-time compiler, application class-data sharing and the 'jlink' linking tool," said Donald Smith, senior director of product management in Oracle's Java Platform Group, in an interview.
Leyden adds to Java optimization efforts
Project Leyden builds upon past projects, including the GNU Compiler for Java and the Native Image feature of GraalVM. GraalVM is a high-performance runtime with performance optimizations for individual languages, such as Java and JVM languages, JavaScript, Ruby, Python and others, and interoperability for polyglot or multilanguage applications.
As Project Leyden was inspired by GraalVM, the two efforts have components in common that may or may not find their way into the mainstream Java spec. However, lacking further information at this time, some observers see the two projects as intertwined.
"It seems like it [Project Leyden] should be made a part of the GraalVM project, which I believe the authors are hoping to do, as it addresses the very same objectives espoused by GraalVM, except here, they're proposing the creation of an extremely streamlined runtime environment that's specific to a single app," said Bradley Shimmin, an analyst with Omdia in Longmeadow, Mass. "Basically, it marries the app with the VM, removing every library that's not in use by that app. I'm not sure if it works the same way, but I see this same notion within Oracle's own Project Valhalla."
Bradley ShimminAnalyst, Omdia
Project Valhalla is an ongoing effort at Oracle that introduces value types, a mechanism that allows data used by Java programs to be managed much more efficiently at runtime. When Project Valhalla is finally incorporated into the JDK, the whole performance landscape will change, Oracle says.
In addition, other big Java community constituents like what they see and are looking forward to how they can use the project's output.
For instance, at the core, GraalVM is based on OpenJDK and Red Hat has over a decade of expertise in maintaining and performance-optimizing VMs and the company hopes to bring that to the GraalVM community, according to Rich Sharples, senior director of product management at Red Hat.
Red Hat is also interested in Project Leyden, as it "aims to provide most of what we need from Graal/SubstrateVM within OpenJDK itself," Sharples said.
Leyden could prove useful for IoT and cloud
Further, Reinhold explains that static images are not for every type of application. But they could be useful in IoT and cloud situations, or as Reinhold put it: "deployment scenarios such as small embedded devices and the cloud."
Project Leyden will start with a clone of the current JDK main-line release, JDK 15, Reinhold said. It will then track the main-line releases going forward and be delivered over time in a series of JDK enhancement proposals before becoming a permanent feature.