You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "G-XD (via GitHub)" <gi...@apache.org> on 2023/09/25 12:17:00 UTC
[GitHub] [incubator-opendal] G-XD commented on issue #3138: Can OpenDAL Java binding running on GraalVM?
G-XD commented on issue #3138:
URL: https://github.com/apache/incubator-opendal/issues/3138#issuecomment-1733588131
Hi, I tried it on an ubuntu system and it works fine with the `JNIConfigurationFiles` and `IncludeResources` parameters specified. see: https://github.com/G-XD/opendal-graalvm.git
<details>
<summary>
```bash
./mvnw -Pnative native:compile
```
</summary>
```plaintext
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Detecting the operating system and CPU architecture
[INFO] ------------------------------------------------------------------------
[INFO] os.detected.name: linux
[INFO] os.detected.arch: x86_64
[INFO] os.detected.bitness: 64
[INFO] os.detected.version: 5.15
[INFO] os.detected.version.major: 5
[INFO] os.detected.version.minor: 15
[INFO] os.detected.release: ubuntu
[INFO] os.detected.release.version: 22.04
[INFO] os.detected.release.like.ubuntu: true
[INFO] os.detected.release.like.debian: true
[INFO] os.detected.classifier: linux-x86_64
[WARNING] The requested profile "native" could not be activated because it does not exist.
[INFO]
[INFO] ----------------------< org.gxd:opendal-graalvm >-----------------------
[INFO] Building opendal-graalvm 1.0-SNAPSHOT
[INFO] from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] >>> native:0.9.27:compile (default-cli) > package @ opendal-graalvm >>>
[INFO]
[INFO] --- resources:3.3.0:resources (default-resources) @ opendal-graalvm ---
[INFO] skip non existing resourceDirectory /home/ubuntu/gxd/opendal-graalvm/src/main/resources
[INFO]
[INFO] --- compiler:3.10.1:compile (default-compile) @ opendal-graalvm ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /home/ubuntu/gxd/opendal-graalvm/target/classes
[INFO]
[INFO] --- resources:3.3.0:testResources (default-testResources) @ opendal-graalvm ---
[INFO] skip non existing resourceDirectory /home/ubuntu/gxd/opendal-graalvm/src/test/resources
[INFO]
[INFO] --- compiler:3.10.1:testCompile (default-testCompile) @ opendal-graalvm ---
[INFO] No sources to compile
[INFO]
[INFO] --- surefire:3.0.0:test (default-test) @ opendal-graalvm ---
[INFO] No tests to run.
[INFO]
[INFO] --- jar:3.1.0:jar (default-jar) @ opendal-graalvm ---
[INFO] Building jar: /home/ubuntu/gxd/opendal-graalvm/target/opendal-graalvm-1.0-SNAPSHOT.jar
[INFO]
[INFO] --- dependency:3.1.0:copy-dependencies (copy) @ opendal-graalvm ---
[INFO] Copying opendal-java-0.40.0.jar to /home/ubuntu/gxd/opendal-graalvm/target/lib/opendal-java-0.40.0.jar
[INFO] Copying opendal-java-0.40.0-linux-x86_64.jar to /home/ubuntu/gxd/opendal-graalvm/target/lib/opendal-java-0.40.0-linux-x86_64.jar
[INFO]
[INFO] --- assembly:3.3.0:single (default) @ opendal-graalvm ---
[INFO] Building jar: /home/ubuntu/gxd/opendal-graalvm/target/opendal-graalvm-1.0-SNAPSHOT-jar-with-dependencies.jar
[INFO]
[INFO] <<< native:0.9.27:compile (default-cli) < package @ opendal-graalvm <<<
[INFO]
[INFO]
[INFO] --- native:0.9.27:compile (default-cli) @ opendal-graalvm ---
[INFO] Found GraalVM installation from JAVA_HOME variable.
[INFO] Executing: /home/ubuntu/gxd/graalvm-jdk-17.0.8+9.1/bin/native-image -cp /home/ubuntu/gxd/opendal-graalvm/target/classes:/home/ubuntu/.m2/repository/org/apache/opendal/opendal-java/0.40.0/opendal-java-0.40.0.jar:/home/ubuntu/.m2/repository/org/apache/opendal/opendal-java/0.40.0/opendal-java-0.40.0-linux-x86_64.jar --no-fallback -o /home/ubuntu/gxd/opendal-graalvm/target/opendal-graalvm --no-fallback --initialize-at-build-time=org.springframework.util.unit.DataSize --initialize-at-build-time=org.slf4j.MDC --initialize-at-build-time=ch.qos.logback.classic.Level --initialize-at-build-time=ch.qos.logback.classic.Logger --initialize-at-build-time=ch.qos.logback.core.util.StatusPrinter --initialize-at-build-time=ch.qos.logback.core.status.StatusBase --initialize-at-build-time=ch.qos.logback.core.status.InfoStatus --initialize-at-build-time=ch.qos.logback.core.spi.AppenderAttachableImpl --initialize-at-build-time=org.slf4j.LoggerFactory --initialize-at-build-time=ch.qos.logback.cor
e.util.Loader --initialize-at-build-time=org.slf4j.impl.StaticLoggerBinder --initialize-at-build-time=ch.qos.logback.classic.spi.ThrowableProxy --initialize-at-build-time=ch.qos.logback.core.CoreConstants --report-unsupported-elements-at-runtime --allow-incomplete-classpath -H:+ReportExceptionStackTraces -H:JNIConfigurationFiles=./jni-config.json -H:IncludeResources=.*/*indings.properties$ -H:IncludeResources=.*/*.opendal_java.so$ org.gxd.Main
Warning: Using a deprecated option --allow-incomplete-classpath from command line. Allowing an incomplete classpath is now the default. Use --link-at-build-time to report linking errors at image build time for a class or package.
========================================================================================================================
GraalVM Native Image: Generating 'opendal-graalvm' (executable)...
========================================================================================================================
[1/8] Initializing... (5.7s @ 0.11GB)
Java version: 17.0.8+9-LTS, vendor version: Oracle GraalVM 17.0.8+9.1
Graal compiler: optimization level: 2, target machine: x86-64-v3, PGO: ML-inferred
C compiler: gcc (linux, x86_64, 11.2.0)
Garbage collector: Serial GC (max heap size: 80% of RAM)
[2/8] Performing analysis... [***] (25.7s @ 0.48GB)
3,613 (73.36%) of 4,925 types reachable
4,432 (51.82%) of 8,553 fields reachable
17,774 (47.20%) of 37,657 methods reachable
1,208 types, 0 fields, and 569 methods registered for reflection
64 types, 58 fields, and 64 methods registered for JNI access
4 native libraries: dl, pthread, rt, z
[3/8] Building universe... (3.1s @ 0.70GB)
[4/8] Parsing methods... [***] (9.9s @ 0.39GB)
[5/8] Inlining methods... [***] (1.7s @ 0.40GB)
[6/8] Compiling methods... [*******] (58.9s @ 0.62GB)
[7/8] Layouting methods... [*] (1.7s @ 0.90GB)
[8/8] Creating image... [**] (2.5s @ 1.14GB)
8.20MB (10.70%) for code area: 9,191 compilation units
67.68MB (88.36%) for image heap: 120,199 objects and 7 resources
735.60kB ( 0.94%) for other data
76.60MB in total
------------------------------------------------------------------------------------------------------------------------
Top 10 origins of code area: Top 10 object types in image heap:
6.11MB java.base 59.97MB byte[] for embedded resources
1.61MB svm.jar (Native Image) 1.63MB byte[] for code metadata
165.07kB java.logging 944.23kB byte[] for java.lang.String
116.09kB com.oracle.svm.svm_enterprise 861.54kB java.lang.String
32.12kB org.graalvm.sdk 852.32kB byte[] for general heap data
30.92kB org.graalvm.nativeimage.base 642.14kB java.lang.Class
27.16kB jdk.crypto.ec 313.63kB java.util.HashMap$Node
16.72kB opendal-java-0.40.0.jar 169.36kB com.oracle.svm.core.hub.DynamicHubCompanion
15.27kB jdk.internal.vm.compiler 164.86kB byte[] for reflection metadata
14.52kB jdk.internal.vm.ci 141.99kB char[]
7.03kB for 5 more packages 1.19MB for 929 more object types
------------------------------------------------------------------------------------------------------------------------
Recommendations:
G1GC: Use the G1 GC ('--gc=G1') for improved latency and throughput.
PGO: Use Profile-Guided Optimizations ('--pgo') for improved throughput.
HEAP: Set max heap for improved and more predictable memory usage.
CPU: Enable more CPU features with '-march=native' for improved performance.
QBM: Use the quick build mode ('-Ob') to speed up builds during development.
------------------------------------------------------------------------------------------------------------------------
5.5s (4.9% of total time) in 100 GCs | Peak RSS: 2.06GB | CPU load: 3.68
------------------------------------------------------------------------------------------------------------------------
Produced artifacts:
/home/ubuntu/gxd/opendal-graalvm/target/opendal-graalvm (executable)
========================================================================================================================
Finished generating 'opendal-graalvm' in 1m 49s.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:56 min
[INFO] Finished at: 2023-09-25T20:03:29+08:00
[INFO] ------------------------------------------------------------------------
[WARNING] The requested profile "native" could not be activated because it does not exist.
[WARNING]
[WARNING] Plugin validation issues were detected in 5 plugin(s)
[WARNING]
[WARNING] * org.apache.maven.plugins:maven-jar-plugin:3.1.0
[WARNING] * org.apache.maven.plugins:maven-assembly-plugin:3.3.0
[WARNING] * org.apache.maven.plugins:maven-compiler-plugin:3.10.1
[WARNING] * org.apache.maven.plugins:maven-resources-plugin:3.3.0
[WARNING] * org.apache.maven.plugins:maven-dependency-plugin:3.1.0
[WARNING]
[WARNING] For more or less details, use 'maven.plugin.validation' property with one of the values (case insensitive): [BRIEF, DEFAULT, VERBOSE]
[WARNING]
```
</details>

--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org