Commit fdcc0bd 1 parent c7695d6 commit fdcc0bd Copy full SHA for fdcc0bd
File tree 10 files changed +68
-2
lines changed
10 files changed +68
-2
lines changed Original file line number Diff line number Diff line change @@ -315,9 +315,10 @@ https://github.com/stick-i/spel-validator/releases
315
315
### 分支说明
316
316
317
317
- ` main ` :主分支,已发布的最新版本代码将合入此分支。
318
- - ` docs ` :文档分支,修改文档的内容将提交到这里。
319
318
- ` vX.Y.Z ` :版本分支,用于汇总及验证新版本的功能,已经发布的版本会将分支删除。
320
- - ` dev-xxx ` :开发分支,用于开发新功能,每个dev分支都应当对应一个issue,功能开发完成后通过PR合入 ` vX.Y.Z ` 分支,并删除当前分支。
319
+ - ` dev-num-desc ` :开发分支,用于开发新功能,每个dev分支都应当对应一个issue,功能开发完成后通过PR合入 ` vX.Y.Z ` 分支,并删除当前分支。
320
+ - ` docs ` :文档分支,修改文档的内容将提交到这里。
321
+ - ` gh-pages ` :GitHub Pages 分支,用于发布在线文档。
321
322
322
323
## 💰 捐赠支持
323
324
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ export const navbarZh: NavbarOptions = [
10
10
'/guide/user-guide.md' ,
11
11
'/guide/spel.md' ,
12
12
'/guide/custom.md' ,
13
+ '/guide/FAQ.md' ,
13
14
] ,
14
15
} ,
15
16
{
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ export const sidebarZh: SidebarOptions = {
10
10
'/guide/user-guide.md' ,
11
11
'/guide/spel.md' ,
12
12
'/guide/custom.md' ,
13
+ '/guide/FAQ.md' ,
13
14
] ,
14
15
} ,
15
16
] ,
Original file line number Diff line number Diff line change
1
+ # 常见问题
2
+
3
+ ## 关于性能
4
+
5
+ 我对[ 示例项目] ( https://github.com/stick-i/spel-validator-example ) 创建了一组简单的api测试用例,共15个请求,在后面的测试中,我会使用它们来进行测试。
6
+
7
+ ![ img_4.png] ( ../image/faq-api-test.png )
8
+
9
+ ::: tip 测试环境
10
+
11
+ - Mac mini 2023款,M2芯片,16G内存
12
+ - 示例项目的接口中无业务逻辑,只有参数校验
13
+ - SpEL Validator 版本:v0.2.0-beta
14
+ - JDK版本:8
15
+ - SpringBoot版本:2.7.17
16
+
17
+ :::
18
+
19
+ ### 执行耗时
20
+
21
+ 测试条件:
22
+
23
+ - 开启debug日志
24
+ - 接口未预热
25
+ - 使用Apifox进行2线程3循环的测试,共90次请求
26
+
27
+ 测试结果:
28
+
29
+ 除了前几次请求耗时会达到 10ms 以上,
30
+ 后续请求耗时会稳定在 0~ 1ms 左右。
31
+
32
+ ![ img_2.png] ( ../image/faq-execution-time1.png )
33
+ ![ img.png] ( ../image/faq-execution-time2.png )
34
+
35
+ 其中每条记录表示一次接口调用的完整校验耗时。
36
+
37
+ ### 火焰图
38
+
39
+ 测试条件:
40
+
41
+ - 关闭debug日志
42
+ - 接口充分预热
43
+ - 使用 Apifox 进行10线程10循环的测试,共1500次请求
44
+ - 使用 IDEA 自带的 IntelliJ Profiler 进行分析
45
+
46
+ 得到如下的火焰图
47
+
48
+ ![ img_1.png] ( ../image/faq-flame1.png )
49
+
50
+ ![ img_5.png] ( ../image/faq-flame2.png )
51
+
52
+ 可以看到,本组件的总耗时为170ms,平均每个请求耗时约0.11ms。
53
+
54
+ 其中解析SpEL表达式的总耗时为110ms,占比约65%。
55
+
56
+ 随后我在不同的数量的线程和循环次数后重新测试,得到的结果如下:
57
+
58
+ - 5线程100循环,共7500次请求,总耗时约为 930ms,平均每个请求耗时约0.12ms,其中解析SpEL表达式的总耗时为 420ms,占比约45%。
59
+ - 20线程,30循环,共9000次此请求,总耗时约为 1190ms,平均每个请求耗时约0.13ms,其中解析SpEL表达式的总耗时为 390ms,占比约33%。
60
+
61
+ 这样看来,目前的性能表现还算可以接受,但还有优化空间,后续会继续优化。
Original file line number Diff line number Diff line change 5
5
6
6
下面以 ` @SpelNotNull ` 为例,展示如何实现自定义约束注解。
7
7
8
+ ** 以下内容还没写完**
9
+
8
10
## 创建约束注解类
9
11
10
12
``` java
You can’t perform that action at this time.
0 commit comments