xuxiaowei-com-cn opened a new issue, #8164: URL: https://github.com/apache/incubator-seata/issues/8164
### Check Ahead - [x] I have searched the [issues](https://github.com/seata/seata/issues) of this repository and believe that this is not a duplicate. - [x] I am willing to try to implement this feature myself. ### Why you need it? Seata namingserver currently runs only on the JVM, requiring a JDK/JRE runtime environment. This introduces: - **Larger footprint**: JVM-based deployment needs a full JDK/JRE, increasing image size and memory consumption. - **Slower startup**: JVM class loading and warmup add seconds to startup time, which is problematic in containerized/cloud-native environments where fast scaling is essential. - **Operational complexity**: Managing JDK versions, JVM tuning parameters, and GC behavior adds overhead. Supporting GraalVM native image compilation would enable the namingserver to be compiled into a standalone native binary, delivering **sub-second startup**, **reduced memory footprint**, and **simplified deployment** — aligning with the cloud-native and Kubernetes-native deployment trends. ### How it could be? ### Build Pipeline 1. **Metadata generation phase** (`package-namingserver-native-metadata` + `run-namingserver-native-metadata`): - Package the namingserver as an executable JAR. - Run it with `-agentlib:native-image-agent` to trace reflection, resources, serialization, and proxy usage. - Output reachability metadata to `target/native-image-config/`. 2. **Metadata merge phase** (`run-merge-native-namingserver`): - Run `script/native/merge_native_image_config.py` to merge the agent-generated metadata into the existing native-image config files (e.g., `reflect-config.json`, `resource-config.json`). 3. **Native compilation phase** (`package-namingserver-native`): - Run `spring-boot:process-aot` for Spring Boot AOT processing. - Run `native:compile` via GraalVM `native-maven-plugin` to produce the native binary. ### Configuration Changes - Add **GraalVM `native-maven-plugin`** (`org.graalvm.buildtools`) with version `1.1.3` to the parent POM's plugin management. - Add a **`native` profile** to `namingserver/pom.xml` with `spring-boot:process-aot` and `native:compile` bindings. - Add a **`release-seata-jar` profile** for producing the executable JAR with `spring-boot:repackage`. - Add **platform-specific profiles** (`native-linux-amd64`, `native-linux-aarch64`, `native-darwin-x86_64`, `native-darwin-aarch64`, `native-windows-amd64`) for setting `native.platform` classifier. - **Makefile**: Add `package-namingserver-native`, `run-namingserver-native-metadata`, `run-merge-native-namingserver` targets. ### Native Image Metadata - Add `reflect-config.json` with reflection entries for Seata classes (serialization, Spring configuration, management endpoints). - Add `resource-config.json` with resource bundle and configuration patterns. - **`logback-spring.xml`**: Remove `<if>` conditional logic — GraalVM native images do not support dynamic Logback conditionals at build time. Use fixed `resource` includes instead. - Configure `spotless-maven-plugin` to also format JSON files under `META-INF/native-image/`. ### Other related information - **Target version**: Seata 2.x - **GraalVM**: Requires GraalVM JDK 25+ with `native-image` installed. - **Tested platforms**: macOS (aarch64), Linux (amd64). - The merge script (`merge_native_image_config.py`) supports an extensible design — additional config file types can be added via the `KEY_TO_FILE` map. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
