All Projects → Jotschi → vertx-graalvm-native-image-test

Jotschi / vertx-graalvm-native-image-test

Licence: Apache-2.0 license
GraalVM - Substrate VM - Test project for Vert.x

Programming Languages

shell
77523 projects
java
68154 projects - #9 most used programming language
Dockerfile
14818 projects

Projects that are alternatives of or similar to vertx-graalvm-native-image-test

ghidraal
A Ghidra extension for scripting with GraalVM languages, including Javascript, Python3, R, and Ruby.
Stars: ✭ 48 (+26.32%)
Mutual labels:  graalvm
graalvm-ce-dev-builds
GraalVM Dev Build Downloads
Stars: ✭ 76 (+100%)
Mutual labels:  graalvm
dragon
DRAGON Stack manager
Stars: ✭ 20 (-47.37%)
Mutual labels:  graalvm
GraalVMREPL
REPL (read–eval–print loop) shell built on top of JavaFX and GraalVM stack, incorporating GraalJS, GraalPython, TruffleRuby and FastR
Stars: ✭ 31 (-18.42%)
Mutual labels:  graalvm
mozart-graal
An implementation of Oz on top of Truffle and Graal
Stars: ✭ 37 (-2.63%)
Mutual labels:  graalvm
openapi4j
OpenAPI 3 parser, JSON schema and request validator.
Stars: ✭ 92 (+142.11%)
Mutual labels:  graalvm
Truffleruby
A high performance implementation of the Ruby programming language. Built on the GraalVM by Oracle Labs.
Stars: ✭ 2,620 (+6794.74%)
Mutual labels:  graalvm
tools-deps-native
Run tools-deps-alpha as a native binary.
Stars: ✭ 30 (-21.05%)
Mutual labels:  graalvm
graalvm-native-image-plugin
A Gradle plugin which creates a native executable via GraalVM's native-image. This is a thin wrapper of the native-image command.
Stars: ✭ 90 (+136.84%)
Mutual labels:  graalvm
java-metadata
Project collecting release metadata of various JDK distributions.
Stars: ✭ 18 (-52.63%)
Mutual labels:  graalvm
grakkit
A modern JavaScript development environment for Minecraft.
Stars: ✭ 184 (+384.21%)
Mutual labels:  graalvm
scala-http4s-realworld-example-app
Example of a RealWorld app backend powered by Scala + http4s
Stars: ✭ 35 (-7.89%)
Mutual labels:  graalvm
springboot-helloworld-native
Example helloWorld SpringBoot project which compiles to native code with GraalVM
Stars: ✭ 14 (-63.16%)
Mutual labels:  graalvm
micronaut-camunda-external-client
This open source project allows you to easily integrate Camunda's External Task Clients into Micronaut projects: simply add a dependency in your Micronaut project
Stars: ✭ 19 (-50%)
Mutual labels:  graalvm
docker-graalvm
A base image to run apps using https://www.graalvm.org
Stars: ✭ 11 (-71.05%)
Mutual labels:  graalvm
Google-Authenticator
Clojure program to compute your google authenticator OTP using TOTP
Stars: ✭ 23 (-39.47%)
Mutual labels:  graalvm
clojure-rust-graalvm
An example of Clojure program calling a Rust library, all combined into one executable using GraalVM.
Stars: ✭ 113 (+197.37%)
Mutual labels:  graalvm
scala-graalvm-lambda
Sample application of Native Scala with GraalVM.
Stars: ✭ 15 (-60.53%)
Mutual labels:  graalvm
mysql-mle-demos
Demos for the MySQL Multi-Lingual Environment
Stars: ✭ 16 (-57.89%)
Mutual labels:  graalvm
setup-graalvm
No description or website provided.
Stars: ✭ 63 (+65.79%)
Mutual labels:  graalvm

Vert.x GraalVM - Native Image Test

This is a basic test project which uses GraalVM / Substrate VM VM to build a native image of a Vert.x Web application.

How to build

I prepared and tested the build only on Linux but it should also work on other platforms.

  1. Build a shaded jar of your application
  2. Run the native-image tool from GraalVM to generate the executable

The build.sh file contains more details about needed arguments.

Patches

In this test project I patched a few Vert.x and Netty classes to avoid imports related to native transports and SSL. Otherwise the image could not be build.

Vert.x Transport

First I needed to patch the io.vertx.core.net.impl.transport.Transport class in order to prevent the loading of EPoll and KQueue native support. Otherwise Substrate VM will try to load these classes and fail.

public class Transport {
…
  /**
   * The native transport, it may be {@code null} or failed.
   */
  public static Transport nativeTransport() {
    // Patched: I remove the native transport discovery. 
    // The imports would be picked up by substrate 
    // and cause further issues. 
    return null;
  }
…
}

Netty SSL

Native SSL support is another problematic area. I created a patched dummy io.netty.handler.ssl.ReferenceCountedOpenSslEngine class in order to prevent Substrate VM from digging deeper into the SSL code of Netty.

Netty Reflections

Next we need to set up the reflection configuration within reflectconfigs/netty.json.

Netty uses reflection to instantiate the socket channels. This is done in the ReflectiveChannelFactory. We need to tell Substrate VM how classes of type NioServerSocketChannel and NioSocketChannel can be instantiated.

[
  {
    "name" : "io.netty.channel.socket.nio.NioSocketChannel",
    "methods" : [
      { "name" : "<init>", "parameterTypes" : [] }
    ]
  },
  {
    "name" : "io.netty.channel.socket.nio.NioServerSocketChannel",
    "methods" : [
      { "name" : "<init>", "parameterTypes" : [] }
    ]
  }
]

Limitations

Native EPoll, KQueue support, SSL is not yet working.

Related issue: oracle/graal#353

Blog post

More information can also be found in my post on the Vert.x blog.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].