In the Dubbo 3.3.0 version, we officially released the Dubbo AOT static solution. This document will introduce how to connect applications to GraalVM Native Image through Dubbo AOT technology, the process of compiling applications into native binary packages, and the components currently supported.
Due to the rapid development of Dubbo AOT technology, this document may not always be up to date. Please refer to the following content for the latest information and usage:
For more information about GraalVm, you can read the document at https://www.graalvm.org/docs/getting-started/container-images/.
Native Image Compilation: Pre-compile applications into native images to reduce startup time and memory usage.
Language Interoperability: GraalVM allows writing code in multiple languages to interoperate within the same application.
Optimization: GraalVM provides optimizations for applications written in Java, JavaScript, and other languages, enhancing the performance of Dubbo applications.
Polyglot Debugging: GraalVM can debug code written in multiple languages within the same session, which is very useful for troubleshooting issues in complex Dubbo applications.
Java Runtime: It can run on GraalVM, providing a faster, more efficient Java runtime environment.
Developing Microservices: It can be combined with GraalVM to create high-performance, low-resource-utilization microservices.
Before compiling our Dubbo project, ensure that we are based on a GraalVM environment.
This includes maven-compiler-plugin, spring-boot-maven-plugin, native-maven-plugin, and dubbo-maven-plugin. Modify the mainClass in dubbo-maven-plugin to the full path of the required startup class. (The API usage does not require adding the spring-boot-maven-plugin dependency.)
The API usage does not require adding the dubbo-config-spring6 dependency.
Example configuration:
Run the following compile command in the project’s root path:
The binary file is located in the target/ directory, usually named after the project, for example, target/native-demo.
Component Name | Required Plugin | Plugin Version | Notes |
---|---|---|---|
Apache Commons Logging | native-maven-plugin | 0.9.24 and above | |
JDK Logger | native-maven-plugin | 0.9.24 and above | |
slf4j | spring-boot-maven-plugin | 3.x.x (latest version) | |
Log4j | native-maven-plugin | 0.10.0 and above | |
Log4j2 |
Component Name | Required Plugin | Plugin Version | Notes |
---|---|---|---|
FastJson2 | dubbo-maven-plugin | 3.3.0 and above | |
JDK | native-maven-plugin | 0.9.24 and above | |
Hessian-Lite | Not friendly with JDK 17, unsupported for now |
Component Name | Required Plugin | Plugin Version | Notes |
---|---|---|---|
Zookeeper | dubbo-maven-plugin | 3.3.0 | Only supports Zookeeper Curator5 |
Component Name | Required Plugin | Plugin Version | Notes |
---|---|---|---|
Zookeeper | dubbo-maven-plugin | 3.3.0 | Only supports Zookeeper Curator5 |
Component Name | Required Plugin | Plugin Version | Notes |
---|---|---|---|
Zookeeper | dubbo-maven-plugin | 3.3.0 | Only supports Zookeeper Curator5 |
Component Name | Required Plugin | Plugin Version | Notes |
---|---|---|---|
Micrometer |