This repository has been archived by the owner on Feb 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from lvjing2/dev
add pages for sofaserverless
- Loading branch information
Showing
41 changed files
with
1,000 additions
and
497 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,68 @@ | ||
--- | ||
title: Overview | ||
title: 产品简介 | ||
description: Here's where your user finds out if your project is for them. | ||
weight: 1 | ||
--- | ||
|
||
{{% pageinfo %}} | ||
This is a placeholder page that shows you how to use this template site. | ||
{{% /pageinfo %}} | ||
## 介绍 | ||
SOFAServerless 是一种模块化的 Serverless 技术,它能让普通应用以比较低的代价演进为 Serverless 研发模式,让代码与资源解耦,轻松独立维护,与此同时支持秒级构建部署、合并部署、动态伸缩等能力为用户提供极致的研发运维体验,最终帮助企业实现降本增效。 | ||
|
||
随着各行各业的信息化数字化转型,企业面临越来越多的研发效率、协作效率、资源成本和服务治理痛点,接下来带领大家逐一体验这些痛点,以及它们在 SOFAServerless 中是如何被解决的。 | ||
|
||
The Overview is where your users find out about your project. Depending on the size of your docset, you can have a separate overview page (like this one) or put your overview contents in the Documentation landing page (like in the Docsy User Guide). | ||
|
||
Try answering these questions for your user in this page: | ||
## 企业痛点与解法 | ||
### 构建发布慢且 SDK 升级繁琐 | ||
传统应用镜像化构建一般要 3 - 5 分钟,单机代码发布到启动完成也要 3 - 5 分钟,开发者每次验证代码修改或上线代码修改,都需要经历数次 6 - 10 分钟的构建发布等待,严重影响开发效率。此外,每次 SDK 升级(比如中间件框架、rpc、logging、json 等),都需要修改所有应用代码并重新构建发布,对开发者也造成了不必要的打扰。 | ||
|
||
## What is it? | ||
通过使用 SOFAServerless 通用基座与配套工具,您可以低成本的将应用切分为 “基座” 与 “模块”,其中基座沉淀了公司或者某个业务部门的公共 SDK,基座升级可以由专人负责,对业务开发者无感,业务开发者只需要编写模块。在我们目前支持的 Java 技术栈中,模块就是一个 SpringBoot 应用代码包(FatJar),只不过 SpringBoot 框架本身和其他的企业公共依赖在运行时会让基座提前加载预热,模块每次发布都会找一台预热 SpringBoot 的基座进行热部署,整个过程类似 AppEngine,能够帮用户实现应用 10 秒级构建发布和公共 SDK 升级无感。 | ||
|
||
Introduce your project, including what it does or lets you do, why you would use it, and its primary goal (and how it achieves it). This should be similar to your README description, though you can go into a little more detail here if you want. | ||
{{% imgproc sdk Fit "600x400" %}} | ||
[//]: # (<b style="text-align: center">默认的书籍和排序</b>) | ||
{{% /imgproc %}} | ||
|
||
## Why do I want it? | ||
### 长尾应用资源成本高昂 | ||
在企业中,80% 的应用只服务了不到 20% 的流量,同时伴随着业务的变化,企业存在大量的长尾应用,这些长尾应用 CPU 使用率长期不到 10%,造成了极大的资源浪费。 | ||
|
||
Help your user know if your project will help them. Useful information can include: | ||
通过使用 SOFAServerless 合并部署与配套工具,您可以低成本的实现多个应用的合并部署,从而解决企业应用过度拆分和低流量业务带来的资源浪费,节约成本。 | ||
|
||
* **What is it good for?**: What types of problems does your project solve? What are the benefits of using it? | ||
{{% imgproc resource_cost Fit "600x400" %}} | ||
[//]: # (<b style="text-align: center">默认的书籍和排序</b>) | ||
{{% /imgproc %}} | ||
|
||
* **What is it not good for?**: For example, point out situations that might intuitively seem suited for your project, but aren't for some reason. Also mention known limitations, scaling issues, or anything else that might let your users know if the project is not for them. | ||
这里 “业务A 应用1” 在 SOFAServerless 术语中叫 “模块”。多个模块应用可以使用 SOFAArk 技术合并到同一个基座。基座可以是完全空的 SpringBoot应用(Java 技术栈),也可以下沉一些公共 SDK 到基座,模块应用每次发布会重启基座机器。在这种方式下,模块应用最大程度复用了基座的内存(Metaspace 和 Heap),构建产物大小也能从数百 MB 瘦身到几十 MB 甚至更激进,CPU 使用率也得到了有效提升。 | ||
|
||
* **What is it *not yet* good for?**: Highlight any useful features that are coming soon. | ||
### 研发协作效率低 | ||
在企业中,一些应用需要多人开发协作。在传统研发模式下,每一个人的代码变更都需要发布整个应用,这就导致应用需要以赶火车式的方式进行研发迭代,大家需要统一一个时间窗口做迭代开发,统一的时间点做发布上线,因此存在大量的需求上线相互等待、环境机器抢占、迭代冲突等情况。 | ||
|
||
## Where should I go next? | ||
通过使用 SOFAServerless,您可以方便的将应用拆分为一个基座与多个功能模块,一个功能模块就是一组代码文件。不同的功能模块可以同时进行迭代开发和发布运维,模块间互不感知互不影响,这样就消除了传统应用迭代赶火车式的相互等待,每个模块拥有自己的独立迭代,需求交付效率因此得到了极大提升。如果您对模块额外启用了热部署方式(也可以每次发布模块重启整个基座),那么模块的单次构建+发布也会从普通应用的 6 - 10 分钟减少到十秒级。 | ||
|
||
Give your users next steps from the Overview. For example: | ||
{{% imgproc cooperation Fit "600x400" %}} | ||
[//]: # (<b style="text-align: center">默认的书籍和排序</b>) | ||
{{% /imgproc %}} | ||
|
||
* [Getting Started](/docs/getting-started/): Get started with $project | ||
* [Examples](/docs/examples/): Check out some example code! | ||
### 难以沉淀业务资产提高中台效率 | ||
在一些大型企业中,会沉淀各种业务中台应用。中台一般封装了业务的公共 API 实现,和 SPI 定义。其中 SPI 定义允许中台上的插件去实现各自的业务逻辑,流量进入中台应用后,会调用对应的 SPI 实现组件去完成相应的业务逻辑。中台应用内的组件,业务逻辑一般不复杂,如果拆出去部署为独立应用会带来高昂的资源成本和运维成本,而且构建发布速度很慢,严重加剧研发负担影响研发效率。 | ||
|
||
通过使用 SOFAServerless,您可以方便的将中台应用拆分一个基座和多个功能模块。基座可以沉淀比较厚的业务依赖、公共逻辑、API 实现、SPI 定义等(即所谓的业务资产),提供给上面的模块使用。模块使用基座的能力可以是对象之间或 Bean 之间的直接调用,代码几乎不用改造。而且多个模块间可以同时进行迭代开发和发布运维,互不感知互不影响,协作交付效率得到了极大提升。此外对于比较简单的模块还可以开启热部署,单次构建+发布也会从普通应用的 6 - 10 分钟减少到 30 秒内。 | ||
|
||
{{% imgproc mid-platform Fit "600x400" %}} | ||
[//]: # (<b style="text-align: center">默认的书籍和排序</b>) | ||
{{% /imgproc %}} | ||
|
||
### 微服务演进成本高 | ||
不同业务有不同发展阶段,因此应用也有自己的生命周期。 | ||
|
||
初创期:一个初创的应用一般会先采用单体架构。 | ||
|
||
增长期:随着业务增长,应用开发者也随之增加。此时您可能不确定业务的未来前景,也不希望过早把业务拆分成多个应用以避免不必要的维护、治理和资源成本,那么您可以用 SOFAServerless 低成本地将应用拆分为一个基座和多个功能模块,不同功能模块之间可以并行研发运维独立迭代,互不影响。 | ||
|
||
成熟期:随着业务进一步增长,您可以进一步使用 SOFAServerless 低成本地将部分或全部功能模块拆分成独立应用研发运维。 | ||
|
||
长尾期:部分业务在经历增长期或者成熟期后,也可能慢慢步入到低活或者长尾状态,此时可以用 SOFAServerless 低成本地将这些应用一键改回模块,合并部署到一起实现降本增效。 | ||
|
||
可以看到 SOFAServerless 支持企业应用低成本地在初创期、增长期、成熟期、长尾期之间平滑过渡甚至来回切换,从而轻松让应用架构与业务发展保持同步。 | ||
|
||
{{% imgproc app-evolution Fit "600x400" %}} | ||
[//]: # (<b style="text-align: center">默认的书籍和排序</b>) | ||
{{% /imgproc %}} | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
title: "基座接入" | ||
date: 2023-09-14T10:28:35+08:00 | ||
draft: false | ||
weight: 2 | ||
--- | ||
|
||
## test, 请补充内容 |
52 changes: 52 additions & 0 deletions
52
docs/content/zh-cn/docs/Tutorials/Base/springboot_sofaboot.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
--- | ||
title: "Springboot_sofaboot" | ||
date: 2023-09-14T10:31:44+08:00 | ||
weight: 1 | ||
--- | ||
|
||
## 前提条件 | ||
1. 您的应用是 SpringBoot 应用或者是 SOFABoot 应用。SpringBoot2 和 SpringBoot3、SOFABoot3 和 SOFABoot4 均支持。其中需要 SpringBoot >= 2.0 版本、SOFABoot >= 3.9 版本。 | ||
2. 您的应用当前使用 K8S 做发布运维。2024 年我们会支持非容器化部署的应用,比如应用部署在虚拟机上仍然能使用 SOFAServerless 模块研发运维体系。 | ||
|
||
## 接入步骤 | ||
### 步骤 1:修改应用主 pom.xml | ||
|
||
升级 SpringBoot 或者 SOFABoot 到最低版本后,修改应用主 pom.xml 和 bootstrap/pom.xml,并引入 Serverless 运行时依赖: | ||
|
||
```xml | ||
<dependencyManagement> | ||
<!-- If SpringBoot Application --> | ||
<dependencies> | ||
<groupId>com.alipay.sofa.serverless</groupId> | ||
<artifactId>sofa-serverless-runtime-starter</artifactId> | ||
<version>0.1-SNAPSHOT</version> | ||
</dependencies> | ||
<!-- Else If SOFABoot Application --> | ||
<dependencies> | ||
<dependency> | ||
<groupId>com.alipay.sofa</groupId> | ||
<artifactId>runtime-sofa-boot-plugin</artifactId> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
``` | ||
注意:确保主 pom 和 bootstrap/pom.xml 不要直接或间接引入 slf4j-log4j12、jcl-over-slf4j 依赖,可以在 pom 中 exclude 掉这些依赖,不然会导致模块日志打印有问题。 | ||
|
||
### 步骤 2:配置 application.properties(可选) | ||
|
||
有些应用升级到 SpringBoot 或 SOFABoot 高版本后,Spring 会报错 Bean 循环依赖问题,此时需要修改 application.properties: | ||
|
||
```properties | ||
# 如果依赖了高版本的 Spring,默认开启了循环依赖校验,遇到 Spring Bean 循环引用报错,可以关掉: | ||
spring.main.allow-circular-references=true | ||
``` | ||
|
||
### 步骤 3:Metaspace 大小修改 | ||
|
||
如果开启了模块热部署,业务在模块卸载的事件处理函数中又没有做比较彻底的资源清理,那么每次热部署模块可能会导致 Metaspace 增长,最终会频繁触发 FullGC 导致模块部署变得很慢。为了加快部署、增加热部署次数、提高稳定性,强烈建议对 JVM 参数进行修改,调大 PermGen 或者 Metaspace 大小。示例: | ||
|
||
```properties | ||
-XX:MetaspaceSize=512m -XX:MaxMetaspaceSize=512m | ||
``` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
title: 模块研发 | ||
description: Show your user how to work through some end to end examples. | ||
date: 2017-01-04 | ||
weight: 2 | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
title: 模块规范 | ||
date: 2017-01-04 | ||
weight: 2 | ||
--- | ||
|
||
## 基础规范 | ||
|
||
1. 如果使用了热卸载,模块自定义的 Timer、ThreadPool 等需要在模块卸载时手动清理,官方兼容的中间件无需关心,会被 SOFAServerelss 自动清理。您可以监听 Spring 的 ContextClosedEvent 事件,在事件处理函数中清理必要资源,也可以在 Spring XML 定义 Timer、ThreadPool 的地方指定它们的 destroy-method,在模块卸载时,Spring 会自动执行 destroy-method。 | ||
2. 基座启动时会部署所有模块,所以基座编码时,一定要向所有模块兼容,否则基座会发布失败。如果遇到无法绕过的不兼容变更(一般是在模块拆分过程中会有比较多的基座与模块不兼容变更),请参见基座与模块不兼容发布。 | ||
|
||
## 日志规范 | ||
|
||
1. 请使用 slf4j 提供的接口获取 Logger 并打印日志。 | ||
2. 日志配置文件统一为 resources/log4j2-spring.xml。 | ||
3. 如果使用异步日志,请使用 RollingFileAppender 搭配 AsyncLogger/AsyncRoot 的组合。 | ||
4. 确保未引入这些依赖 slf4j-log4j12、jcl-over-slf4j、logback-classic、logback-core。 | ||
|
||
如果有任何日志问题,请先看 stdout.log 和 stderr.log 里是否有日志初始化相关报错,再进一步排查。 |
Oops, something went wrong.