From b387c2a627581245e6271cb60c4e621e7897bdad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E6=B6=9B?= Date: Thu, 20 Aug 2026 23:37:06 +0800 Subject: [PATCH 1/5] feat: optimize framework runtime defaults for 1.1.1 --- docs/framework-1.1-plan.md | 12 ++++++------ docs/migration-1.1.md | 7 ++++--- docs/roadmap.md | 3 ++- opensabre-base-dependencies/pom.xml | 12 ++++++++++-- pom.xml | 2 +- 5 files changed, 23 insertions(+), 13 deletions(-) diff --git a/docs/framework-1.1-plan.md b/docs/framework-1.1-plan.md index 84375cc..aa3db56 100644 --- a/docs/framework-1.1-plan.md +++ b/docs/framework-1.1-plan.md @@ -12,7 +12,7 @@ Java 21 为编译和最低运行基线,以 JDK 21、25 为 CI 保障版本;J | Spring Cloud | 2025.1.2 | 2025.1.2 | 已官方声明支持 Boot 4.1 | | Spring Cloud Alibaba | 2025.1.0.0 | 待正式兼容版本 | 不使用上游 SNAPSHOT 发布 | | Java | 21 | 编译 21;CI 21/25 | 两套完整构建、测试和 Javadoc 通过 | -| 镜像 | Temurin 21 Alpine JVM | JDK/JRE 25 JVM;Linux amd64 Native | 非 root、日志、时区、健康检查均验证 | +| 镜像 | Temurin 21 Alpine JVM | Temurin 25 Alpine JVM | 非 root、日志、时区、健康检查及容器内存参数均验证 | Spring Cloud Alibaba 的公开 2025.1.0.0 版本表只声明支持 Boot 4.0.x;其 `2025.1.x` 分支虽已 切换到 Boot 4.1.0 和 Cloud 2025.1.2,但尚未发布为正式 BOM。Framework 可在保持已发布 @@ -23,7 +23,7 @@ Spring Cloud Alibaba 的公开 2025.1.0.0 版本表只声明支持 Boot 4.0.x; ### 阶段 1:构建矩阵与可复现基线(进行中) -1. 在 `feature/1.1` 分支上维护所有变更,发布前再创建 `release/1.1.0`。 +1. 1.1.0 已作为升级基线发布;后续优化在 `feature/1.1.1-jvm-optimization` 上维护。 2. GitHub Actions 建立 JDK 21/25 矩阵,运行 `mvn -B verify javadoc:javadoc --file pom.xml`。 3. 在两套 JDK 下记录 Framework 全模块构建结果;任何 JDK 25 特有失败先修复构建插件或测试。 @@ -41,7 +41,7 @@ Spring Cloud Alibaba 的公开 2025.1.0.0 版本表只声明支持 Boot 4.0.x; 完成标准:JDK 21/25 的全模块 `verify` 与 Javadoc 均通过,且没有未解释的依赖覆盖。 -### 阶段 3:Native 能力和 Runtime Hints +### 阶段 3:Native 能力和 Runtime Hints(延期) 1. 复用 Spring Boot 4.1 的 Native Build Tools 路径,提供可选 `-Pnative`,不改变默认 JVM 构建。 2. 以已有 Native 原型的 base 应用为验证样本;将反射、代理、资源和序列化问题收敛为各 Starter @@ -51,11 +51,11 @@ Spring Cloud Alibaba 的公开 2025.1.0.0 版本表只声明支持 Boot 4.0.x; 完成标准:样本应用可由文档化命令构建并运行 Native,核心链路有自动化或可重复的集成验证。 -### 阶段 4:JVM 25 / Native OCI 镜像 +### 阶段 4:JVM 25 OCI 镜像(1.1.1) 1. 在现有 Jib 所有权扩展、非 root `1001`、`${REGISTRY_URL}`、认证、版本/latest 标签和 `/app/logs` 卷基础上扩展,不另建平行发布链路。 -2. JVM profile 默认使用可配置的 JDK/JRE 25 基础镜像;Native profile 使用无 JDK 的最小 Linux +2. JVM profile 默认使用可配置的 JDK/JRE 25 基础镜像;Native profile 不在 1.1.1 范围内。 运行时镜像,并显式保留 CA 证书、时区和必要字体。 3. 对两种镜像验证用户、入口命令、端口、health、配置和日志,并记录层复用率。 @@ -66,7 +66,7 @@ Spring Cloud Alibaba 的公开 2025.1.0.0 版本表只声明支持 Boot 4.0.x; 1. 用候选 Framework 版本在本地升级至少一个受影响 base 应用;启动其配置中心与依赖服务,确认 实际订阅预期 Nacos Data ID,再测试受保护接口等关键链路。 2. 记录 1.0.0 与 1.1 的镜像大小、压缩推送大小、启动时间和空载内存,注明环境和测量命令。 -3. 完成升级指南、Native/Jib 使用指南、版本矩阵、变更日志、回滚与降级清单。 +3. 完成升级指南、Jib 使用指南、版本矩阵、变更日志、回滚与降级清单。 4. 经维护者确认后推送候选分支;CI 成功且再次确认后才创建 Release、Maven Central 发布和分支合并。 完成标准:Issue #64 全部验收项有链接到测试、命令、基准和文档的证据;发布动作仍须单独审批。 diff --git a/docs/migration-1.1.md b/docs/migration-1.1.md index 18d1c2d..199b9a9 100644 --- a/docs/migration-1.1.md +++ b/docs/migration-1.1.md @@ -18,11 +18,11 @@ Spring Cloud 2025.1.2 已支持 Spring Boot 4.1。Spring Cloud Alibaba 的已发 ## 应用升级步骤 -1. 将父 POM 或 BOM 更新至 Framework 1.1 候选版本,保留 `maven.compiler.release` 为 `21`。 +1. 将父 POM 或 BOM 更新至 Framework 1.1.1,保留 `maven.compiler.release` 为 `21`。 2. 在 JDK 21、JDK 25 分别执行应用的 `mvn test`;业务使用 Spring Cloud Alibaba 时,至少启动一次 使用真实 Nacos Config Data 的集成环境。 3. 验证配置实际订阅预期 Nacos Data ID、服务注册、数据库、缓存、RPC、鉴权和健康检查。 -4. 若应用使用反射、JDK 动态代理、资源扫描或动态序列化,在 Native 阶段将所需提示提交到对应 +4. 若应用使用反射、JDK 动态代理、资源扫描或动态序列化,在后续 Native 阶段将所需提示提交到对应 Framework Starter,而不是在每个应用复制 `reflect-config.json`。 ## Nacos 公共配置 @@ -53,6 +53,7 @@ GitHub Actions 对 JDK 21 和 JDK 25 执行相同命令。发布前还必须完 ## 已知限制 -- 此阶段不改变默认 JVM 打包路径;Native Image 和双模式 OCI 镜像将作为独立阶段交付。 +- 1.1.1 将默认 JVM 运行时切换为 `eclipse-temurin:25-jre-alpine`,并设置容器内存比例(初始 10%,最大 60%)及 OOM 退出策略。 +- Native Image 暂不纳入 1.1.1 发布范围,保留为后续专项工作;MyBatis-Plus、Nacos、Sentinel 的 Native 兼容性需要独立验证。 - Spring Cloud Alibaba 的正式 Boot 4.1 认证尚待其上游发布,不能据此直接宣称所有 Alibaba 组件已 获完整生产认证。 diff --git a/docs/roadmap.md b/docs/roadmap.md index 5831498..3105915 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -2,6 +2,7 @@ - 逐个 Starter 完成独立模块文档与可运行示例的双向链接。 - 建立 Spring Boot、Spring Cloud、Java 版本的兼容性矩阵。 -- [Framework 1.1 升级实施计划](framework-1.1-plan.md):Boot 4.1、JDK 21/25、Native Image 与双模式 OCI 镜像的阶段门禁。 +- [Framework 1.1 升级实施计划](framework-1.1-plan.md):Boot 4.1 与 JDK 21/25 的升级基线。 +- Framework 1.1.1:默认 Java 25 JVM 镜像、容器内存参数与镜像体积优化;Native Image 暂缓。 - 为自动配置、配置项、公共 API 建立弃用和迁移策略。 - 将审计、事件、缓存、持久化等跨模块能力形成端到端参考实现。 diff --git a/opensabre-base-dependencies/pom.xml b/opensabre-base-dependencies/pom.xml index 9fe3b75..87f6542 100644 --- a/opensabre-base-dependencies/pom.xml +++ b/opensabre-base-dependencies/pom.xml @@ -46,6 +46,9 @@ 33.4.0-jre 3.0.5 3.5.2 + eclipse-temurin:25-jre-alpine + 10 + 60 5.11.4 5.4.1 @@ -331,7 +334,7 @@ - eclipse-temurin:21-jre-alpine + ${jib.base.image} @@ -353,7 +356,12 @@ Asia/Shanghai - -XX:+UseContainerSupport + + -XX:+UseContainerSupport + -XX:InitialRAMPercentage=${jib.jvm.initial-ram-percentage} + -XX:MaxRAMPercentage=${jib.jvm.max-ram-percentage} + -XX:+ExitOnOutOfMemoryError + USE_CURRENT_TIMESTAMP diff --git a/pom.xml b/pom.xml index 384eb6e..2d58e70 100644 --- a/pom.xml +++ b/pom.xml @@ -68,7 +68,7 @@ 0.9.0 1.18.42 - 1.1.0 + 1.1.1 From 13ce9066206307aa99b0dc2edb6094cf41995bcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E6=B6=9B?= Date: Thu, 20 Aug 2026 23:47:59 +0800 Subject: [PATCH 2/5] feat: expose conservative JVM memory limits --- docs/framework-1.1-plan.md | 2 +- docs/migration-1.1.md | 2 +- opensabre-base-dependencies/pom.xml | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/framework-1.1-plan.md b/docs/framework-1.1-plan.md index aa3db56..7b3d466 100644 --- a/docs/framework-1.1-plan.md +++ b/docs/framework-1.1-plan.md @@ -57,7 +57,7 @@ Spring Cloud Alibaba 的公开 2025.1.0.0 版本表只声明支持 Boot 4.0.x; `/app/logs` 卷基础上扩展,不另建平行发布链路。 2. JVM profile 默认使用可配置的 JDK/JRE 25 基础镜像;Native profile 不在 1.1.1 范围内。 运行时镜像,并显式保留 CA 证书、时区和必要字体。 -3. 对两种镜像验证用户、入口命令、端口、health、配置和日志,并记录层复用率。 +3. 对 JVM 镜像验证用户、入口命令、端口、health、配置、日志和 JVM 内存边界,并记录层复用率。 完成标准:两种镜像均以非 root 启动,现有 Registry 和日志约定不被破坏。 diff --git a/docs/migration-1.1.md b/docs/migration-1.1.md index 199b9a9..45f7f81 100644 --- a/docs/migration-1.1.md +++ b/docs/migration-1.1.md @@ -53,7 +53,7 @@ GitHub Actions 对 JDK 21 和 JDK 25 执行相同命令。发布前还必须完 ## 已知限制 -- 1.1.1 将默认 JVM 运行时切换为 `eclipse-temurin:25-jre-alpine`,并设置容器内存比例(初始 10%,最大 60%)及 OOM 退出策略。 +- 1.1.1 将默认 JVM 运行时切换为 `eclipse-temurin:25-jre-alpine`,并设置容器内存比例(初始 10%,最大 60%)、线程栈 `256k`、Metaspace 上限 `128m`、Direct Memory 上限 `128m` 及 OOM 退出策略。应用可通过 Jib 属性覆盖这些默认值;使用大量线程、动态代理或 Netty 的应用应在压测后调整。 - Native Image 暂不纳入 1.1.1 发布范围,保留为后续专项工作;MyBatis-Plus、Nacos、Sentinel 的 Native 兼容性需要独立验证。 - Spring Cloud Alibaba 的正式 Boot 4.1 认证尚待其上游发布,不能据此直接宣称所有 Alibaba 组件已 获完整生产认证。 diff --git a/opensabre-base-dependencies/pom.xml b/opensabre-base-dependencies/pom.xml index 87f6542..1ddef35 100644 --- a/opensabre-base-dependencies/pom.xml +++ b/opensabre-base-dependencies/pom.xml @@ -49,6 +49,9 @@ eclipse-temurin:25-jre-alpine 10 60 + 256k + 128m + 128m 5.11.4 5.4.1 @@ -360,6 +363,9 @@ -XX:+UseContainerSupport -XX:InitialRAMPercentage=${jib.jvm.initial-ram-percentage} -XX:MaxRAMPercentage=${jib.jvm.max-ram-percentage} + -Xss${jib.jvm.stack-size} + -XX:MaxMetaspaceSize=${jib.jvm.max-metaspace-size} + -XX:MaxDirectMemorySize=${jib.jvm.max-direct-memory-size} -XX:+ExitOnOutOfMemoryError USE_CURRENT_TIMESTAMP From 46fc69ae74a4942bf2a1fcd6dc30821813da9d7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E6=B6=9B?= Date: Thu, 20 Aug 2026 23:52:06 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BC=98=E5=8C=96=20RPC=20starter=20?= =?UTF-8?q?=E7=9A=84=20Sentinel=20=E5=8F=AF=E9=80=89=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- opensabre-starter-rpc/pom.xml | 3 +++ .../opensabre/rpc/sentinel/config/OpensabreSentinelConfig.java | 2 ++ 2 files changed, 5 insertions(+) diff --git a/opensabre-starter-rpc/pom.xml b/opensabre-starter-rpc/pom.xml index 3204374..cccedca 100644 --- a/opensabre-starter-rpc/pom.xml +++ b/opensabre-starter-rpc/pom.xml @@ -61,16 +61,19 @@ com.alibaba.cloud spring-cloud-starter-alibaba-sentinel + true com.alibaba.cloud spring-cloud-alibaba-sentinel-datasource + true com.alibaba.csp sentinel-datasource-nacos + true diff --git a/opensabre-starter-rpc/src/main/java/io/github/opensabre/rpc/sentinel/config/OpensabreSentinelConfig.java b/opensabre-starter-rpc/src/main/java/io/github/opensabre/rpc/sentinel/config/OpensabreSentinelConfig.java index 1a312ee..8169063 100644 --- a/opensabre-starter-rpc/src/main/java/io/github/opensabre/rpc/sentinel/config/OpensabreSentinelConfig.java +++ b/opensabre-starter-rpc/src/main/java/io/github/opensabre/rpc/sentinel/config/OpensabreSentinelConfig.java @@ -3,9 +3,11 @@ import io.github.opensabre.rpc.sentinel.exception.SentinelExceptionHandlerAdvice; import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.context.annotation.Import; @AutoConfiguration +@ConditionalOnClass(name = "com.alibaba.csp.sentinel.slots.block.BlockException") @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET) @Import({SentinelExceptionHandlerAdvice.class}) public class OpensabreSentinelConfig { From 4c8f4e3cc6a3cb1bd49abe170d49194db4bcb328 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E6=B6=9B?= Date: Thu, 20 Aug 2026 23:55:51 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E6=96=87=E6=A1=A3=E5=8C=96=20Sentinel=20?= =?UTF-8?q?=E5=8F=AF=E9=80=89=E4=BE=9D=E8=B5=96=E7=AD=96=E7=95=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/migration-1.1.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/migration-1.1.md b/docs/migration-1.1.md index 45f7f81..0ab9b28 100644 --- a/docs/migration-1.1.md +++ b/docs/migration-1.1.md @@ -55,5 +55,6 @@ GitHub Actions 对 JDK 21 和 JDK 25 执行相同命令。发布前还必须完 - 1.1.1 将默认 JVM 运行时切换为 `eclipse-temurin:25-jre-alpine`,并设置容器内存比例(初始 10%,最大 60%)、线程栈 `256k`、Metaspace 上限 `128m`、Direct Memory 上限 `128m` 及 OOM 退出策略。应用可通过 Jib 属性覆盖这些默认值;使用大量线程、动态代理或 Netty 的应用应在压测后调整。 - Native Image 暂不纳入 1.1.1 发布范围,保留为后续专项工作;MyBatis-Plus、Nacos、Sentinel 的 Native 兼容性需要独立验证。 +- Sentinel 依赖在 `opensabre-starter-rpc` 中改为可选依赖,不再默认进入应用镜像;需要 Sentinel 的应用必须显式声明对应依赖,并在部署层启用 Sentinel 控制台。 - Spring Cloud Alibaba 的正式 Boot 4.1 认证尚待其上游发布,不能据此直接宣称所有 Alibaba 组件已 获完整生产认证。 From a8b870bfcddecc071162e6a82e2fd6cb62a04445 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E6=B6=9B?= Date: Fri, 21 Aug 2026 00:19:15 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E8=AE=B0=E5=BD=95=20AppCDS=20=E4=B8=8E=20J?= =?UTF-8?q?ib=20classpath=20=E5=85=BC=E5=AE=B9=E6=80=A7=E7=BB=93=E8=AE=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/migration-1.1.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/migration-1.1.md b/docs/migration-1.1.md index 0ab9b28..f1f9968 100644 --- a/docs/migration-1.1.md +++ b/docs/migration-1.1.md @@ -56,5 +56,6 @@ GitHub Actions 对 JDK 21 和 JDK 25 执行相同命令。发布前还必须完 - 1.1.1 将默认 JVM 运行时切换为 `eclipse-temurin:25-jre-alpine`,并设置容器内存比例(初始 10%,最大 60%)、线程栈 `256k`、Metaspace 上限 `128m`、Direct Memory 上限 `128m` 及 OOM 退出策略。应用可通过 Jib 属性覆盖这些默认值;使用大量线程、动态代理或 Netty 的应用应在压测后调整。 - Native Image 暂不纳入 1.1.1 发布范围,保留为后续专项工作;MyBatis-Plus、Nacos、Sentinel 的 Native 兼容性需要独立验证。 - Sentinel 依赖在 `opensabre-starter-rpc` 中改为可选依赖,不再默认进入应用镜像;需要 Sentinel 的应用必须显式声明对应依赖,并在部署层启用 Sentinel 控制台。 +- AppCDS 试点结论:Spring Boot fat jar 直接生成的归档与 Jib exploded classpath 不一致,不能直接复用。后续应在 Jib 的 `/app/classes:/app/resources:/app/libs/*` 布局上按应用生成归档,并作为显式 profile 启用,暂不作为默认镜像内容。 - Spring Cloud Alibaba 的正式 Boot 4.1 认证尚待其上游发布,不能据此直接宣称所有 Alibaba 组件已 获完整生产认证。