Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GraalVM Native Image #103

Open
ryan-2048 opened this issue Apr 8, 2024 · 4 comments
Open

GraalVM Native Image #103

ryan-2048 opened this issue Apr 8, 2024 · 4 comments
Assignees

Comments

@ryan-2048
Copy link

ryan-2048 commented Apr 8, 2024

Is it possible to support compiling Native Images with GraalVM? I have encountered reflection issues. If it can be compiled into binary files, it will be a great success for low performance machines!

========================================================================================================================
GraalVM Native Image: Generating 'tb-edge-3.5.1.1EDGE-boot' (executable)...

[1/7] Initializing... (7.3s @ 0.23GB)
Version info: 'GraalVM 22.3.5 Java 11 EE'
Java version info: '11.0.22+9-LTS-jvmci-22.3-b32'
C compiler: gcc (linux, x86_64, 9.4.0)
Garbage collector: Serial GC
[2/7] Performing analysis... [******] (25.2s @ 1.11GB)
3,547 (75.12%) of 4,722 classes reachable
4,613 (55.13%) of 8,368 fields reachable
17,333 (48.80%) of 35,519 methods reachable
147 classes, 0 fields, and 475 methods registered for reflection
59 classes, 59 fields, and 52 methods registered for JNI access
4 native libraries: dl, pthread, rt, z
[3/7] Building universe... (2.6s @ 1.70GB)

Warning: Reflection method java.lang.Class.forName invoked at org.springframework.boot.loader.PropertiesLauncher.wrapWithCustomClassLoader(PropertiesLauncher.java:368)
Warning: Reflection method java.lang.Class.forName invoked at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:46)
Warning: Reflection method java.lang.Class.getMethod invoked at org.springframework.boot.loader.jar.JarFileEntries.(JarFileEntries.java:66)
Warning: Reflection method java.lang.Class.getDeclaredMethod invoked at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:47)
Warning: Reflection method java.lang.Class.getDeclaredConstructor invoked at org.springframework.boot.loader.PropertiesLauncher.newClassLoader(PropertiesLauncher.java:385)
Warning: Reflection method java.lang.Class.getDeclaredConstructor invoked at org.springframework.boot.loader.jar.Handler.getFallbackHandler(Handler.java:200)
Warning: Aborting stand-alone image build due to reflection use without configuration.
Warning: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception

                    1.0s (2.7% of total time) in 15 GCs | Peak RSS: 2.25GB | CPU load: 3.25

========================================================================================================================
Failed generating 'tb-edge-3.5.1.1EDGE-boot' after 35.5s.
Generating fallback image...
Warning: Image 'tb-edge-3.5.1.1EDGE-boot' is a fallback image that requires a JDK for execution (use --no-fallback to suppress fallback image generation and to print more detailed information why a fallback image was necessary).

@ryan-2048 ryan-2048 changed the title Your title here GraalVM Native Image Apr 9, 2024
@AndriiLandiak
Copy link
Member

Hi, @Kevin-ox.

Could you provide more details of your configuration?

Here is my flow: I recently updated to the latest version of tb-edge on Ubuntu by installing the .deb package from the site. To leverage the capabilities of JVMCI (JVM Compiler Interface), which is supported in Java 11, I made some adjustments to the tb-edge.conf configuration file. Specifically, I appended the following JAVA_OPTS to enable JVMCI and specify GraalVM as the compiler, including an option to display the compiler configuration information:

export JAVA_OPTS="$JAVA_OPTS -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseJVMCICompiler -Dgraal.ShowConfiguration=info"

As a result, it enabled me to use GraalVM as a compiler with a specific log:

Using Graal compiler configuration 'community' provided by org.graalvm.compiler.hotspot.CommunityCompilerConfigurationFactory loaded from jrt:/jdk.internal.vm.compiler/org/graalvm/compiler/hotspot/CommunityCompilerConfigurationFactory.class

Regarding the status of tb-edge, running service tb-edge status might display some errors, but it's important to note that these don't impact the functioning of Edge, and it operates as expected.
image

@AndriiLandiak
Copy link
Member

I am closing this issue due to inactivity. Please feel free to reopen it if you have any more questions.

@ryan-2048
Copy link
Author

I wanted to release a native image (instead of a. jar file) to greatly improve performance, but was unsuccessful.

@ryan-2048
Copy link
Author

@AndriiLandiak

@AndriiLandiak AndriiLandiak reopened this Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants