generated from just-the-docs/just-the-docs-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
97 additions
and
2 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 |
---|---|---|
@@ -0,0 +1,79 @@ | ||
--- | ||
layout: default | ||
title: 压力测试 | ||
parent: Test | ||
--- | ||
|
||
# arthas thrace命令分析耗时 | ||
|
||
```text | ||
[arthas@82]$ trace com.test.web.controller.OrderUniteController queryOrderPage -n 5 --skipJDKMethod false | ||
Press Q or Ctrl+C to abort. | ||
Affect(class count: 1 , method count: 1) cost in 655 ms, listenerId: 1 | ||
`---ts=2024-01-22 11:02:30;thread_name=http-nio-9166-exec-6;id=122;is_daemon=true;priority=5;TCCL=org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedWebappClassLoader@5ea0f263 | ||
`---[197.718153ms] com.test.web.controller.OrderUniteController:queryOrderPage() | ||
+---[0.16% 0.321685ms ] org.slf4j.Logger:info() #83 | ||
+---[0.01% 0.014182ms ] com.test.web.request.OrderUnitePageDTO:getOrderType() #84 | ||
+---[0.01% 0.010145ms ] com.test.common.to.PaginationRequest:<init>() #101 | ||
+---[0.02% 0.043364ms ] com.test.web.mapstruct.OrderUniteMapStruct:pageDtoToRequest() #102 | ||
+---[8.46% 16.728599ms ] com.test.web.controller.OrderUniteController:setDataAuthByOrderType() #104 | ||
+---[0.01% 0.011294ms ] com.test.common.to.PaginationRequest:setConditions() #107 | ||
+---[0.00% 0.008099ms ] com.test.web.request.OrderUnitePageDTO:getPageSize() #108 | ||
+---[0.00% 0.008459ms ] com.test.common.to.PaginationRequest:setPageSize() #108 | ||
+---[0.00% 0.009668ms ] com.test.web.request.OrderUnitePageDTO:getPageIndex() #109 | ||
+---[0.00% 0.007329ms ] com.test.common.to.PaginationRequest:setPageNum() #109 | ||
+---[87.44% 172.885494ms ] com.test.web.client.OrderUniteClient:queryOrderPage() #110 | ||
+---[0.04% 0.070558ms ] com.test.web.mapstruct.OrderUniteMapStruct:dtoFaceToPageVO() #112 | ||
`---[3.14% 6.209232ms ] com.test.web.controller.OrderUniteController:doVoucherPageSumAmt() #115 | ||
``` | ||
|
||
```text | ||
Affect(class count: 2 , method count: 2) cost in 374 ms, listenerId: 7 | ||
`---ts=2024-01-22 11:46:05;thread_name=DubboServerHandler-10.253.68.210:9165-thread-56;id=9150;is_daemon=true;priority=5;TCCL=org.springframework.boot.loader.LaunchedURLClassLoader@3c8a7e38 | ||
`---[26.0524ms] com.test.core.accounting.impl.TestServiceImpl:queryTestPage() | ||
+---[0.13% 0.034457ms ] com.test.facade.api.request.accounting.TestPageRequest:getPage() #136 | ||
+---[0.03% 0.007267ms ] com.test.facade.api.request.accounting.TestPageRequest:getRows() #136 | ||
+---[0.04% 0.010735ms ] com.baomidou.mybatisplus.extension.plugins.pagination.Page:<init>() #136 | ||
+---[1.94% 0.50524ms ] com.test.core.accounting.impl.TestServiceImpl:buildWrapper() #137 | ||
+---[79.70% 20.763484ms ] com.test.repository.mapper.voucher.TestMapper:selectPage() #137 | ||
+---[0.05% 0.012289ms ] com.baomidou.mybatisplus.extension.plugins.pagination.Page:getRecords() #137 | ||
+---[0.04% 0.010785ms ] com.test.common.to.PaginationResponse:<init>() #138 | ||
+---[0.02% 0.005444ms ] org.apache.commons.collections4.CollectionUtils:isEmpty() #141 | ||
+---[0.11% 0.028614ms ] java.util.Comparator:comparing() #145 | ||
+---[0.10% 0.026304ms ] java.util.Comparator:thenComparingInt() #145 | ||
+---[0.37% 0.096225ms ] java.util.List:sort() #145 | ||
+---[0.72% 0.187958ms ] com.test.repository.mapStruct.TestMapStruct:entityListToDtoList() #147 | ||
+---[0.03% 0.008859ms ] com.test.common.to.PaginationResponse:setList() #147 | ||
+---[0.03% 0.006987ms ] com.baomidou.mybatisplus.extension.plugins.pagination.Page:getTotal() #148 | ||
`---[0.03% 0.007384ms ] com.test.common.to.PaginationResponse:setTotal() #148 | ||
``` | ||
|
||
1. java一般的ger/set方法,比如**getPageSize**,消耗的是0.008099ms,就是8.099ns,非常短 | ||
2. java的(小规模)集合操作,会耗时一小会,[0.37% 0.096225ms ] java.util.List:sort() #145 | ||
3. IO消耗的时间长[79.70% 20.763484ms ] com.test.repository.mapper.voucher.TestMapper:selectPage() #137 | ||
|
||
综合上面的测试及描述。一些核心接口在压力测试时,就要评估好QPS以及TPS。评估时要全面考虑接口的 | ||
复杂度,后续调用链路的长短。一般情况下。电商各条业务线的TPS和QPS可以粗略评估如下 | ||
|
||
# 支付 | ||
|
||
一般支付有读写操作都频繁的核心接口如下 | ||
|
||
- 核心支付 | ||
- 取消订单 | ||
- 订单查询 | ||
|
||
# 交易 | ||
|
||
一般支付有读写操作都频繁的核心接口如下 | ||
|
||
- 创建 | ||
- 取消订单 | ||
- 订单查询 | ||
|
||
# 风控 | ||
|
||
风控更多的是查询接口,而且一般是使用多级缓存(本地缓存、分布式缓存)来降低调用链路的时延 | ||
|
||
- 黑名单查询 | ||
- 灰产询 |