Sitemap
Palantir Blog

Palantir Blog

First Steps with Graal and Substrate VM

2 min readNov 7, 2018

--

Press enter or click to view image in full size

Graal’s Substrate VM is a framework that allows compilation of Java programs into self-contained executables. Ever since its announcement, we have been intrigued by the potential benefits of this approach over the standard bytecode plus JVM deployment toolchain. First, native images have obvious performance advantages for CLIs and other environments in which fast start-up time is important. Second, Substrate VM may help reduce the overall memory footprint of long-lived applications. Finally, Substrate VM is very much aligned with our software release and deployment philosophy: we prefer regular deployment and re-deployment of small, immutable images over long-lived application servers with mutable configurations.

We have put together two small libraries during our exploration:

Get Palantir’s stories in your inbox

Join Medium for free to get updates from this writer.

The Gradle plugin makes it easy to generate native images from Gradle projects, for example:

// Main.java
package com.palantir.test;

public final class Main {
public static final void main(String[] args) {
System.out.println("Hello, Graal!");
}
}
// build.gradle
apply plugin: 'com.palantir.graal'
graal {
mainClass 'com.palantir.test.Main'
outputName 'hello-graal'
graalVersion '1.0.0-rc8'
}

The nativeImage Gradle task builds the executable in build/graal/hello-graal.

It's still early days, and there are lot of open questions for us in this space, for instance regarding stability, performance characteristics, or profiling and debugging workflows with Graal and Substrate VM. We invite you to join us on our journey by trying our Gradle tooling, or by sharing your experiences and learnings. GitHub issues and pull-requests are the best place for all discussions and improvements, we look forward to hearing from you!

--

--