首页 > 其他分享 >Spring Boot使用GraalVM编译为native excutable app的日志示例及主要步骤说明

Spring Boot使用GraalVM编译为native excutable app的日志示例及主要步骤说明

时间:2024-06-03 15:44:13浏览次数:12  
标签:tomcat 示例 Spring app apache org embed image native

日志示例

[INFO] --- native-maven-plugin:0.9.28:compile (default-cli) @ my-app ---
[INFO] Found GraalVM installation from GRAALVM_HOME variable.
[INFO] [graalvm reachability metadata repository for ch.qos.logback:logback-classic:1.4.14]: Configuration directory not found. Trying latest version.
[INFO] [graalvm reachability metadata repository for ch.qos.logback:logback-classic:1.4.14]: Configuration directory is ch.qos.logback\logback-classic\1.4.1
[INFO] [graalvm reachability metadata repository for com.fasterxml.jackson.core:jackson-databind:2.15.4]: Configuration directory not found. Trying latest version.
[INFO] [graalvm reachability metadata repository for com.fasterxml.jackson.core:jackson-databind:2.15.4]: Configuration directory is com.fasterxml.jackson.core\jackson-databind\2.15.2
[INFO] [graalvm reachability metadata repository for org.apache.tomcat.embed:tomcat-embed-core:10.1.20]: Configuration directory not found. Trying latest version.
[INFO] [graalvm reachability metadata repository for org.apache.tomcat.embed:tomcat-embed-core:10.1.20]: Configuration directory is org.apache.tomcat.embed\tomcat-embed-core\10.0.20
[INFO] [graalvm reachability metadata repository for com.zaxxer:HikariCP:5.0.1]: Configuration directory is com.zaxxer\HikariCP\5.0.1
[INFO] [graalvm reachability metadata repository for com.mysql:mysql-connector-j:8.3.0]: Configuration directory not found. Trying latest version.
[INFO] [graalvm reachability metadata repository for com.mysql:mysql-connector-j:8.3.0]: Configuration directory is com.mysql\mysql-connector-j\8.0.31
[INFO] [graalvm reachability metadata repository for org.mockito:mockito-core:5.7.0]: Configuration directory not found. Trying latest version.
[INFO] [graalvm reachability metadata repository for org.mockito:mockito-core:5.7.0]: Configuration directory is org.mockito\mockito-core\4.8.1
[INFO] Executing: E:\developer\graalvm-jdk-21.0.1\bin\native-image.cmd @target\tmp\native-image-610846435960355181.args
Warning: The option '-H:ResourceConfigurationResources=META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-core/tomcat-resource.json' is experimental and must be enabled via '-H:+UnlockExperimentalVMOptions' in the future.
Warning: The option '-H:ReflectionConfigurationResources=META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-core/tomcat-reflection.json' is experimental and must be enabled via '-H:+UnlockExperimentalVMOptions' in the future.
Warning: The option '-H:ReflectionConfigurationResources=META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-websocket/tomcat-reflection.json' is experimental and must be enabled via '-H:+UnlockExperimentalVMOptions' in the future.
Warning: The option '-H:ReflectionConfigurationResources=META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-el/tomcat-reflection.json' is experimental and must be enabled via '-H:+UnlockExperimentalVMOptions' in the future.
Warning: The option '-H:ResourceConfigurationResources=META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-el/tomcat-resource.json' is experimental and must be enabled via '-H:+UnlockExperimentalVMOptions' in the future.
Warning: The option '-H:ResourceConfigurationResources=META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-websocket/tomcat-resource.json' is experimental and must be enabled via '-H:+UnlockExperimentalVMOptions' in the future.
Warning: Please re-evaluate whether any experimental option is required, and either remove or unlock it. The build output lists all active experimental options, including where they come from and possible alternatives. If you think an experimental option should be considered as stable, please file an issue.
========================================================================================================================GraalVM Native Image: Generating 'my-app' (executable)...
========================================================================================================================For detailed information and explanations on the build output, visit:
https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md
------------------------------------------------------------------------------------------------------------------------
[1/8] Initializing...                                                                                   (11.6s @ 0.25GB) Java version: 21.0.1+12, vendor version: Oracle GraalVM 21.0.1+12.1
 Graal compiler: optimization level: 2, target machine: x86-64-v3, PGO: ML-inferred
 C compiler: cl.exe (microsoft, x64, 19.37.32824)
 Garbage collector: Serial GC (max heap size: 80% of RAM)
 2 user-specific feature(s):
 - com.oracle.svm.thirdparty.gson.GsonFeature
 - org.springframework.aot.nativex.feature.PreComputeFieldFeature
------------------------------------------------------------------------------------------------------------------------ 2 experimental option(s) unlocked:
 - '-H:ResourceConfigurationResources' (origin(s): 'META-INF\native-image\org.apache.tomcat.embed\tomcat-embed-core\native-image.properties' in 'file:///D:/Users/abc/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/10.1.20/tomcat-embed-core-10.1.20.jar', 'META-INF\native-image\org.apache.tomcat.embed\tomcat-embed-el\native-image.properties' in 'file:///D:/Users/abc/.m2/repository/org/apache/tomcat/embed/tomcat-embed-el/10.1.20/tomcat-embed-el-10.1.20.jar', 'META-INF\native-image\org.apache.tomcat.embed\tomcat-embed-websocket\native-image.properties' in 'file:///D:/Users/abc/.m2/repository/org/apache/tomcat/embed/tomcat-embed-websocket/10.1.20/tomcat-embed-websocket-10.1.20.jar')
 - '-H:ReflectionConfigurationResources' (origin(s): 'META-INF\native-image\org.apache.tomcat.embed\tomcat-embed-core\native-image.properties' in 'file:///D:/Users/abc/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/10.1.20/tomcat-embed-core-10.1.20.jar', 'META-INF\native-image\org.apache.tomcat.embed\tomcat-embed-el\native-image.properties' in 'file:///D:/Users/abc/.m2/repository/org/apache/tomcat/embed/tomcat-embed-el/10.1.20/tomcat-embed-el-10.1.20.jar', 'META-INF\native-image\org.apache.tomcat.embed\tomcat-embed-websocket\native-image.properties' in 'file:///D:/Users/abc/.m2/repository/org/apache/tomcat/embed/tomcat-embed-websocket/10.1.20/tomcat-embed-websocket-10.1.20.jar')
------------------------------------------------------------------------------------------------------------------------Build resources:
 - 14.59GB of memory (45.9% of 31.78GB system memory, determined at start)
 - 12 thread(s) (100.0% of 12 available processor(s), determined at start)
SLF4J(W): No SLF4J providers were found.
SLF4J(W): Defaulting to no-operation (NOP) logger implementation
SLF4J(W): See https://www.slf4j.org/codes.html#noProviders for further details.
[2/8] Performing analysis...  [******]                                                                  (38.9s @ 1.91GB)   18,748 reachable types   (90.3% of   20,756 total)
   29,316 reachable fields  (62.8% of   46,663 total)
   98,283 reachable methods (64.2% of  152,983 total)
    6,073 types, 1,045 fields, and 8,042 methods registered for reflection
       80 types,    62 fields, and    70 methods registered for JNI access
        5 native libraries: crypt32, ncrypt, psapi, version, winhttp
[3/8] Building universe...                                                                               (5.0s @ 2.29GB)
[4/8] Parsing methods...      [****]                                                                    (13.3s @ 2.33GB)
[5/8] Inlining methods...     [****]                                                                     (2.0s @ 1.37GB)
[6/8] Compiling methods...    [*********]                                                               (80.9s @ 2.06GB)
[7/8] Layouting methods...    [***]                                                                      (8.7s @ 2.10GB)
[8/8] Creating image...       [***]                                                                      (8.2s @ 2.44GB)
  53.46MB (57.83%) for code area:    57,810 compilation units
  38.28MB (41.41%) for image heap:  457,435 objects and 352 resources
 712.66kB ( 0.75%) for other data
  92.43MB in total
------------------------------------------------------------------------------------------------------------------------
Top 10 origins of code area:                                Top 10 object types in image heap:
  16.64MB java.base                                           14.96MB byte[] for code metadata
   5.34MB svm.jar (Native Image)                               6.50MB byte[] for java.lang.String
   5.27MB tomcat-embed-core-10.1.20.jar                        3.36MB java.lang.String
   4.12MB java.xml                                             3.33MB java.lang.Class
   2.91MB mysql-connector-j-8.3.0.jar                          1.54MB byte[] for embedded resources
   2.36MB jackson-databind-2.15.4.jar                          1.32MB byte[] for reflection metadata
   2.13MB spring-core-6.1.6.jar                              878.81kB com.oracle.svm.core.hub.DynamicHubCompanion
   1.82MB spring-boot-3.2.5.jar                              848.57kB byte[] for general heap data
 911.31kB spring-beans-6.1.6.jar                             537.34kB c.o.svm.core.hub.DynamicHub$ReflectionMetadata
 784.44kB spring-web-6.1.6.jar                               468.36kB java.lang.String[]
  10.81MB for 112 more packages                                4.60MB for 3938 more object types
                              Use '-H:+BuildReport' to create a report with more details.
------------------------------------------------------------------------------------------------------------------------
Security report:
 - Binary includes Java deserialization.
 - Use '--enable-sbom' to embed a Software Bill of Materials (SBOM) in the binary.
 - The log4j library has been detected, but the version is unavailable. Due to Log4Shell, please ensure log4j is at version 2.17.1 or later.
------------------------------------------------------------------------------------------------------------------------
Recommendations:
 PGO:  Use Profile-Guided Optimizations ('--pgo') for improved throughput.
 INIT: Adopt '--strict-image-heap' to prepare for the next GraalVM release.
 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.
------------------------------------------------------------------------------------------------------------------------
                       12.3s (7.2% of total time) in 298 GCs | Peak RSS: 5.17GB | CPU load: 9.12
------------------------------------------------------------------------------------------------------------------------
Produced artifacts:
 D:\IdeaProjects\my-app\target\jaas.dll (jdk_library)
 D:\IdeaProjects\my-app\target\w2k_lsa_auth.dll (jdk_library)
 D:\IdeaProjects\my-app\target\my-app.exe (executable)
========================================================================================================================
Finished generating 'my-app' in 2m 50s.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  03:11 min
[INFO] Finished at: 2024-06-03T15:32:17+08:00
[INFO] ------------------------------------------------------------------------

主要步骤

[1/8] Initializing...
[2/8] Performing analysis...
[3/8] Building universe...
[4/8] Parsing methods...
[5/8] Inlining methods...
[6/8] Compiling methods...
[7/8] Layouting methods...
[8/8] Creating image...

标签:tomcat,示例,Spring,app,apache,org,embed,image,native
From: https://www.cnblogs.com/jiayuan2006/p/18229027

相关文章